<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover"><title>GitHub 自动合并 PR 笔记 | CC的部落格</title><meta name="author" content="CC康纳百川"><meta name="copyright" content="CC康纳百川"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="ffffff"><article data-clarity-region="article"></article><meta name="description" content="GitHub 自动合并 PR 笔记"><meta property="og:type" content="article"><meta property="og:title" content="GitHub 自动合并 PR 笔记"><meta property="og:url" content="https://blog.ccknbc.cc/posts/github-automatically-merges-pull-requests-notes/"><meta property="og:site_name" content="CC的部落格"><meta property="og:description" content="GitHub 自动合并 PR 笔记"><meta property="og:locale" content="zh_CN"><meta property="og:image" content="https://pic1.afdiancdn.com/user/8a7f563c2e3811ecab5852540025c377/common/75d33bcc96205123aa3a40aae776d793_w2560_h1440_s704.jpg"><meta property="article:published_time" content="2021-01-17T16:00:00.000Z"><meta property="article:modified_time" content="2021-01-17T16:00:00.000Z"><meta property="article:author" content="CC康纳百川"><meta property="article:tag" content="工具"><meta name="twitter:card" content="summary"><meta name="twitter:image" content="https://pic1.afdiancdn.com/user/8a7f563c2e3811ecab5852540025c377/common/75d33bcc96205123aa3a40aae776d793_w2560_h1440_s704.jpg"><link rel="shortcut icon" href="/favicon.ico"><link rel="canonical" href="https://blog.ccknbc.cc/posts/github-automatically-merges-pull-requests-notes/"><link rel="preconnect" href="https://jsd.cdn.zzko.cn"><link rel="preconnect" href="//static.cloudflareinsights.com"><link rel="preconnect" href="//www.clarity.ms"><link rel="preconnect" href="//busuanzi.ibruce.info"><link rel="preconnect" href="https://97MUPN4DMC-dsn.algolia.net" crossorigin=""><meta name="google-site-verification" content="tUkgeN6Ih2ArWtjw47oNSSl4Af2_MWjiKLrzZptUCdM"><meta name="msvalidate.01" content="71ADBCC80D679CEA8080BAFDCD54E368"><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://jsd.cdn.zzko.cn/npm/@fortawesome/fontawesome-free/css/all.min.css"><link rel="stylesheet" href="https://jsd.cdn.zzko.cn/npm/node-snackbar/dist/snackbar.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://jsd.cdn.zzko.cn/npm/@fancyapps/ui/dist/fancybox/fancybox.css" media="print" onload='this.media="all"'><script>(()=>{const t={set:(e,t,a)=>{var o;0!==a&&(o=Date.now(),localStorage.setItem(e,JSON.stringify({value:t,expiry:o+864e5*a})))},get:e=>{var t=localStorage.getItem(e);if(t){t=JSON.parse(t);if(!(Date.now()>t.expiry))return t.value;localStorage.removeItem(e)}}},a=(window.btf={saveToLocal:t,getScript:(o,n={})=>new Promise((t,e)=>{const a=document.createElement("script");a.src=o,a.async=!0,a.onerror=e,a.onload=a.onreadystatechange=function(){var e=this.readyState;e&&"loaded"!==e&&"complete"!==e||(a.onload=a.onreadystatechange=null,t())},Object.keys(n).forEach(e=>{a.setAttribute(e,n[e])}),document.head.appendChild(a)}),getCSS:(o,n=!1)=>new Promise((t,e)=>{const a=document.createElement("link");a.rel="stylesheet",a.href=o,n&&(a.id=n),a.onerror=e,a.onload=a.onreadystatechange=function(){var e=this.readyState;e&&"loaded"!==e&&"complete"!==e||(a.onload=a.onreadystatechange=null,t())},document.head.appendChild(a)}),addGlobalFn:(e,t,a=!1,o=window)=>{var n=o.globalFn||{},d=n[e]||{};a&&d[a]||(d[a=a||Object.keys(d).length]=t,n[e]=d,o.globalFn=n)}},()=>{document.documentElement.setAttribute("data-theme","dark"),null!==document.querySelector('meta[name="theme-color"]')&&document.querySelector('meta[name="theme-color"]').setAttribute("content","#0d0d0d")}),o=()=>{document.documentElement.setAttribute("data-theme","light"),null!==document.querySelector('meta[name="theme-color"]')&&document.querySelector('meta[name="theme-color"]').setAttribute("content","ffffff")};btf.activateDarkMode=a,btf.activateLightMode=o;var e=t.get("theme"),n=window.matchMedia("(prefers-color-scheme: dark)").matches,d=window.matchMedia("(prefers-color-scheme: light)").matches,r=window.matchMedia("(prefers-color-scheme: no-preference)").matches,c=!n&&!d&&!r,n=(void 0===e?(d?o():n?a():(r||c)&&((d=(new Date).getHours())<=6||18<=d?a:o)(),window.matchMedia("(prefers-color-scheme: dark)").addListener(e=>{void 0===t.get("theme")&&(e.matches?a:o)()})):("light"===e?o:a)(),t.get("aside-status"));void 0!==n&&("hide"===n?document.documentElement.classList.add("hide-aside"):document.documentElement.classList.remove("hide-aside"));/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)&&document.documentElement.classList.add("apple")})()</script><script defer data-pjax="data-pjax" src="https://static.cloudflareinsights.com/beacon.min.js" data-cf-beacon="{&quot;token&quot;: &quot;35785b58f09f472ebfd7a2854973e6b8&quot;}"></script><script>!function(t,e,n,a,c,r){t[n]=t[n]||function(){(t[n].q=t[n].q||[]).push(arguments)},(c=e.createElement(a)).async=1,c.src="https://www.clarity.ms/tag/an4gdfm6a9",(r=e.getElementsByTagName(a)[0]).parentNode.insertBefore(c,r)}(window,document,"clarity","script")</script><script>const GLOBAL_CONFIG={postHeadAiDescription:{enable:!0,gptName:"CC",mode:"tianli",switchBtn:!0,btnLink:"https://tianli-blog.club/tianligpt/",randomNum:3,basicWordCount:1e3,key:"VCtoijR43E2uiVWkrZiC",Referer:"https://blog.ccknbc.cc/"},root:"/",algolia:void 0,localSearch:void 0,translate:{defaultEncoding:2,translateDelay:0,msgToTraditionalChinese:"繁",msgToSimplifiedChinese:"简"},noticeOutdate:{limitDay:15,position:"top",messagePrev:"本文最后一次更新为",messageNext:"天前，文章中的某些内容可能已过时！"},highlight:{plugin:"highlight.js",highlightCopy:!0,highlightLang:!0,highlightHeightLimit:!1,highlightFullpage:!0,highlightMacStyle:!0},copy:{success:"复制成功",error:"复制错误",noSupport:"浏览器不支持"},relativeDate:{homepage:!1,post:!1},runtime:"天",dateSuffix:{just:"刚刚",min:"分钟前",hour:"小时前",day:"天前",month:"个月前"},copyright:{limitCount:100,languages:{author:"作者: CC康纳百川",link:"链接: ",source:"来源: CC的部落格",info:"著作权归作者所有。商业转载请联系作者获得授权，非商业转载请注明出处。"}},lightbox:"fancybox",Snackbar:{chs_to_cht:"你已切换为繁体中文",cht_to_chs:"你已切换为简体中文",day_to_night:"你已切换为深色模式",night_to_day:"你已切换为浅色模式",bgLight:"#49b1f5",bgDark:"#1f1f1f",position:"top-center"},infinitegrid:{js:"https://jsd.cdn.zzko.cn/npm/@egjs/infinitegrid/dist/infinitegrid.min.js",buttonText:"加载更多"},isPhotoFigcaption:!1,islazyload:!0,isAnchor:!1,percent:{toc:!0,rightside:!0},autoDarkmode:!0}</script><script id="config-diff">var GLOBAL_CONFIG_SITE={postAI:"GitHub 自动合并 PR 笔记",pageFillDescription:"automerge-action, Usage, Configuration, Supported Events, Limitations, Debugging, License, bulldozer, Contents, Behavior, Configuration, bulldozer.yml Specification, FAQ, Can I specify both ignore and trigger?, Can I specify the body of the commit when using the squash strategy?, What if I don’t want to put config files into each repo?, Bulldozer isn’t merging my commit when it should what could be happening?, Bulldozer isn’t updating my branch when it should what could be happening?, Can Bulldozer work with push restrictions on branches?, Deployment, GitHub App Configuration, Operations, Example Files, Migrating Version 0.4.X to 1.X, Development, Contributing, License, probot-auto-merge, Usage, Configuration, minApprovals (required condition), requiredReviewers (condition default none), maxRequestedChanges (condition default none), blockingBaseBranches (condition default none), requiredBaseBranches (condition default none), blockingLabels (condition default none), requiredLabels (condition default none), blockingTitleRegex (condition default none), requiredTitleRegex (condition default none), blockingBodyRegex (condition default none), requiredBodyRegex (condition default none), reportStatus (default false), updateBranch (default false), deleteBranchAfterMerge (default false), mergeMethod (default merge), mergeCommitMessage (default none), rules (default none), requiredAuthorRole (default none), Development, Setup, Testing, Running, Running on Docker, Running the linter, Deployment, Permissions, Events, Contributing, License, auto-label-merge-conflicts, Purpose, Set up, Arguments, Limitations, Local dev setup, How to use PR Valet, , 本文首发在语雀自动同步更新至的部落格",title:"GitHub 自动合并 PR 笔记",isPost:!0,isHome:!1,isHighlightShrink:!1,isToc:!0,postUpdate:"2021-01-18 00:00:00"}</script><script>"serviceWorker"in navigator&&(navigator.serviceWorker.register("/sw.js",{scope:"/"}).then(r=>{r.onupdatefound=()=>{const e=r.installing;e.onstatechange=()=>{"installed"===e.state&&(navigator.serviceWorker.controller?(void 0!==GLOBAL_CONFIG.Snackbar&&btf.snackbarShow("已刷新缓存，更新为最新内容"),navigator.serviceWorker.controller.postMessage({type:"skipWaiting"})):console.log("第一次注册Service Worker"))}}}),navigator.serviceWorker.addEventListener("message",e=>{e.data&&"refresh"===e.data.type&&(console.log("收到刷新页面请求，开始刷新页面"),window.location.reload())}))</script><link rel="stylesheet" href="https://jsd.cdn.zzko.cn/npm/hexo-butterfly-tag-plugins-plus/lib/assets/font-awesome-animation.min.css" media="defer" onload='this.media="all"'><link rel="stylesheet" href="https://jsd.cdn.zzko.cn/npm/hexo-butterfly-tag-plugins-plus/lib/tag_plugins.css" media="defer" onload='this.media="all"'><meta name="generator" content="Hexo 7.2.0"><link rel="alternate" href="/atom.xml" title="CC的部落格" type="application/atom+xml"><link rel="alternate" href="/rss.xml" title="CC的部落格" type="application/rss+xml"></head><body><script>window.paceOptions={restartOnPushState:!1},btf.addGlobalFn("pjaxSend",()=>{Pace.restart()},"pace_restart")</script><link rel="stylesheet" href="https://jsd.cdn.zzko.cn/gh/CodeByZach/pace/themes/green/pace-theme-flash.css"><script src="https://jsd.cdn.zzko.cn/npm/pace-js/pace.min.js"></script><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="https://jsd.cdn.zzko.cn/gh/ccknbc-backup/cdn/logo/logo.png" onerror='onerror=null,src="https://jsd.cdn.zzko.cn/npm/hexo-theme-anzhiyu/source/img/404.jpg"' alt="avatar"></div><div class="sidebar-site-data site-data is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">38</div></a><a href="/tags/"><div class="headline">标签</div><div class="length-num">7</div></a><a href="/categories/"><div class="headline">分类</div><div class="length-num">7</div></a></div><hr class="custom-hr"><div class="menus_items"><div class="menus_item"><span class="site-page group"><i class="fa-fw fa-solid fa-book-reader"></i><span> 文章</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fa-solid fa-box-archive"></i><span> 归档</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fa-solid fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fa-solid fa-folder-open"></i><span> 分类</span></a></li></ul></div><div class="menus_item"><span class="site-page group"><i class="fa-fw fa-solid fa-cubes"></i><span> 社交</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/blogroll/"><i class="fa-fw fa-solid fa-link"></i><span> 友链</span></a></li><li><a class="site-page child" href="/moments/"><i class="fa-fw fa-solid fa-blog"></i><span> 友圈</span></a></li><li><a class="site-page child" href="/music/"><i class="fa-fw fa-solid fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/essay/"><i class="fa-fw fa-solid fa-comment-alt"></i><span> 短文</span></a></li></ul></div><div class="menus_item"><span class="site-page group"><i class="fa-fw fa-solid fa-desktop"></i><span> 关于</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/sub/"><i class="fa-fw fa-solid fa-bell"></i><span> 订阅</span></a></li><li><a class="site-page child" href="/about/"><i class="fa-fw fa-solid fa-list-check"></i><span> 本站</span></a></li><li><a class="site-page child" href="/privacy-policy/"><i class="fa-fw fa-solid fa-user-secret"></i><span> 隐私</span></a></li><li><a class="site-page child" target="_blank" rel="noopener external nofollow noreferrer" href="https://cc.instatus.com"><i class="fa-fw fa-solid fa-server"></i><span> 状态</span></a></li></ul></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image:url(https://pic1.afdiancdn.com/user/8a7f563c2e3811ecab5852540025c377/common/75d33bcc96205123aa3a40aae776d793_w2560_h1440_s704.jpg)"><nav id="nav"><span id="blog-info"><a href="/" title="CC的部落格"><span class="site-name">CC的部落格</span></a></span><div id="menus"><div id="search-button"><span class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></span></div><div class="menus_items"><div class="menus_item"><span class="site-page group"><i class="fa-fw fa-solid fa-book-reader"></i><span> 文章</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/archives/"><i class="fa-fw fa-solid fa-box-archive"></i><span> 归档</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fa-solid fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/categories/"><i class="fa-fw fa-solid fa-folder-open"></i><span> 分类</span></a></li></ul></div><div class="menus_item"><span class="site-page group"><i class="fa-fw fa-solid fa-cubes"></i><span> 社交</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/blogroll/"><i class="fa-fw fa-solid fa-link"></i><span> 友链</span></a></li><li><a class="site-page child" href="/moments/"><i class="fa-fw fa-solid fa-blog"></i><span> 友圈</span></a></li><li><a class="site-page child" href="/music/"><i class="fa-fw fa-solid fa-music"></i><span> 音乐</span></a></li><li><a class="site-page child" href="/essay/"><i class="fa-fw fa-solid fa-comment-alt"></i><span> 短文</span></a></li></ul></div><div class="menus_item"><span class="site-page group"><i class="fa-fw fa-solid fa-desktop"></i><span> 关于</span><i class="fas fa-chevron-down"></i></span><ul class="menus_item_child"><li><a class="site-page child" href="/sub/"><i class="fa-fw fa-solid fa-bell"></i><span> 订阅</span></a></li><li><a class="site-page child" href="/about/"><i class="fa-fw fa-solid fa-list-check"></i><span> 本站</span></a></li><li><a class="site-page child" href="/privacy-policy/"><i class="fa-fw fa-solid fa-user-secret"></i><span> 隐私</span></a></li><li><a class="site-page child" target="_blank" rel="noopener external nofollow noreferrer" href="https://cc.instatus.com"><i class="fa-fw fa-solid fa-server"></i><span> 状态</span></a></li></ul></div></div><div id="toggle-menu"><span class="site-page"><i class="fas fa-bars fa-fw"></i></span></div></div></nav><div id="post-info"><h1 class="post-title">GitHub 自动合并 PR 笔记</h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2021-01-17T16:00:00.000Z" title="发表于 2021-01-18 00:00:00">2021-01-18</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2021-01-17T16:00:00.000Z" title="更新于 2021-01-18 00:00:00">2021-01-18</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/%E5%B7%A5%E5%85%B7/">工具</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">6.2k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>38分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" data-flag-title="GitHub 自动合并 PR 笔记"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"><i class="fa-solid fa-spinner fa-spin"></i></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><div class="post-ai-description"><div class="ai-title"><i class="fa-solid fa-newspaper"></i><div class="ai-title-text">AI-摘要</div><div id="ai-Toggle" title="CC/Tianli 模式切换">切换</div><i class="fa-solid fa-podcast" title="Tianli 模式下朗读摘要"></i><i class="fa-solid fa-arrow-rotate-right" title="Tianli 模式下刷新摘要"></i><div id="ai-tag">Tianli GPT</div></div><div class="ai-explanation">AI初始化中...</div><div class="ai-btn-box"><div class="ai-btn-item">介绍自己 🙈</div><div class="ai-btn-item">生成摘要 👋</div><div class="ai-btn-item">相关推荐 📖</div><div class="ai-btn-item">前往主页 🏠</div><div class="ai-btn-item" id="go-tianli-blog">前往爱发电购买</div></div><script data-pjax src="/"></script></div><article class="post-content" id="article-container"><p>本文首发在<a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.yuque.com/ccknbc/blog/21/"><strong>语雀</strong></a> 自动同步更新至<a href="https://blog.ccknbc.cc/posts/github-automatically-merges-pull-requests-notes/"><strong>CC 的部落格</strong></a></p><h1>automerge-action</h1><p>GitHub action to automatically merge pull requests when they are ready.</p><p><img src= "" data-lazy-src="https://cdn.nlark.com/yuque/0/2021/svg/8391407/1610874798961-ae345ffc-d1e6-425f-900a-8f69e4ee5a53.svg#height=45&amp;id=oSNvE&amp;originHeight=256&amp;originWidth=564&amp;originalType=binary&amp;ratio=1&amp;rotation=0&amp;showTitle=false&amp;size=0&amp;status=done&amp;style=none&amp;title=&amp;width=100" alt="" loading="lazy"></p><p>When added, this action will run the following tasks on pull requests with the <code>automerge</code> label:</p><ul><li>Changes from the base branch will automatically be merged into the pull request (only when “Require branches to be up to date before merging” is enabled in the branch protection rules)</li><li>When the pull request is ready, it will automatically be merged. The action will only wait for status checks that are marked as required in the branch protection rules</li><li>Pull requests without any configured labels will be ignored</li></ul><p>Labels, merge and update strategies are configurable, see <a href="#configuration">Configuration</a>.</p><p>A pull request is considered ready when:</p><ol><li>the required number of review approvals has been given (if enabled in the branch protection rules) and</li><li>the required checks have passed (if enabled in the branch protection rules) and</li><li>the pull request is up to date (if enabled in the branch protection rules)</li></ol><p>After the pull request has been merged successfully, the branch will <em>not</em> be deleted. To delete branches after they are merged, see <a target="_blank" rel="noopener external nofollow noreferrer" href="https://help.github.com/en/articles/managing-the-automatic-deletion-of-branches">automatic deletion of branches</a>.</p><h2 id="Usage">Usage<a class="fa-solid fa-hashtag" href="#Usage"></a></h2><p>Create a new <code>.github/workflows/automerge.yml</code> file:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">name:</span> <span class="string">automerge</span></span><br><span class="line"><span class="attr">on:</span></span><br><span class="line">  <span class="attr">pull_request:</span></span><br><span class="line">    <span class="attr">types:</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">labeled</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">unlabeled</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">synchronize</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">opened</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">edited</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">ready_for_review</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">reopened</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">unlocked</span></span><br><span class="line">  <span class="attr">pull_request_review:</span></span><br><span class="line">    <span class="attr">types:</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">submitted</span></span><br><span class="line">  <span class="attr">check_suite:</span></span><br><span class="line">    <span class="attr">types:</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">completed</span></span><br><span class="line">  <span class="attr">status:</span> &#123;&#125;</span><br><span class="line"><span class="attr">jobs:</span></span><br><span class="line">  <span class="attr">automerge:</span></span><br><span class="line">    <span class="attr">runs-on:</span> <span class="string">ubuntu-latest</span></span><br><span class="line">    <span class="attr">steps:</span></span><br><span class="line">      <span class="bullet">-</span> <span class="attr">name:</span> <span class="string">automerge</span></span><br><span class="line">        <span class="attr">uses:</span> <span class="string">&quot;pascalgn/automerge-action@v0.13.0&quot;</span></span><br><span class="line">        <span class="attr">env:</span></span><br><span class="line">          <span class="attr">GITHUB_TOKEN:</span> <span class="string">&quot;$<span class="template-variable">&#123;&#123; secrets.GITHUB_TOKEN &#125;&#125;</span>&quot;</span></span><br></pre></td></tr></table></figure><p>For the latest version, see the <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/pascalgn/automerge-action/releases">list of releases</a>.</p><h2 id="Configuration">Configuration<a class="fa-solid fa-hashtag" href="#Configuration"></a></h2><p>The following merge options are supported:</p><ul><li><code>MERGE_LABELS</code>: The labels that need to be present for a pull request to be merged (using <code>MERGE_METHOD</code>). The default value is <code>automerge</code>. This option can be a comma-separated list of labels that will be checked. All labels in the list need to be present, otherwise the pull request will be skipped (until all labels are present). Labels prefixed with an exclamation mark (<code>!</code>) will block a pull request from being merged, when present. For example, when <code>automerge,!wip,!work in progress</code> is given, any pull requests with the labels <code>wip</code> or <code>work in progress</code> and any pull requests <em>without</em> the label <code>automerge</code> will not be merged. Blocking labels take precedence, so if a pull request has both labels <code>wip</code> and <code>automerge</code>, it will not be merged. When an empty string (<code>&quot;&quot;</code>) is given, all pull requests will be merged.</li><li><code>MERGE_REMOVE_LABELS</code>: The labels to automatically remove from a pull request once it has been merged by the action. The default value is <code>&quot;&quot;</code>. This option can be a comma-separated list of labels that will be removed. When an empty string (<code>&quot;&quot;</code>) is given, no labels will be removed.</li><li><code>MERGE_METHOD</code>: Which method to use when merging the pull request into the base branch. Possible values are <code>[merge](https://help.github.com/en/articles/about-pull-request-merges)</code> (create a merge commit), <code>[rebase](https://help.github.com/en/articles/about-pull-request-merges#rebase-and-merge-your-pull-request-commits)</code> (rebase all commits of the branch onto the base branch) or <code>[squash](https://help.github.com/en/articles/about-pull-request-merges#squash-and-merge-your-pull-request-commits)</code> (squash all commits into a single commit). The default option is <code>merge</code>.</li><li><code>MERGE_METHOD_LABELS</code>: Set to allow labels to determine the merge method (see <code>MERGE_METHOD</code> for possible values). For example, <code>automerge=merge,autosquash=squash</code>. If no such label is present, the method set by <code>MERGE_METHOD</code> will be used. The default value is <code>&quot;&quot;</code>.</li><li><code>MERGE_METHOD_LABEL_REQUIRED</code>: Set to <code>true</code> to require one of the <code>MERGE_METHOD_LABELS</code> to be set. The default value is <code>false</code>.</li><li><code>MERGE_COMMIT_MESSAGE</code>: The commit message to use when merging the pull request into the base branch. Possible values are <code>automatic</code> (use GitHub’s default message), <code>pull-request-title</code> (use the pull request’s title), <code>pull-request-description</code> (use the pull request’s description), <code>pull-request-title-and-description</code> or a literal value with optional placeholders (for example <code>Auto merge &#123;pullRequest.number&#125;</code>). The default value is <code>automatic</code>.</li><li><code>MERGE_COMMIT_MESSAGE_REGEX</code>: When using a commit message containing the PR’s body, use the first capturing subgroup from this regex as the commit message. Can be used to separate content that should go with the commit into the code base’s history from boilerplate associated with the PR (licensing notices, check lists, etc). For example, <code>(.*)^---</code> would keep everything up until the first 3-dash line (horizontal rule in MarkDown) from the commit message. The default value is empty, which disables this feature.</li><li><code>MERGE_FILTER_AUTHOR</code>: When set, only pull requests raised by this author will be merged automatically.</li><li><code>MERGE_FORKS</code>: Whether merging from external repositories is enabled or not. By default, pull requests with branches from forked repositories will be merged the same way as pull requests with branches from the main repository. Set this option to <code>false</code> to disable merging of pull requests from forked repositories. The default value is <code>true</code>.</li><li><code>MERGE_RETRIES</code> and <code>MERGE_RETRY_SLEEP</code>: Sometimes, the pull request check runs haven’t finished yet, so the action will retry the merge after some time. The number of retries can be set with <code>MERGE_RETRIES</code>. The default number of retries is <code>6</code> and setting it to <code>0</code> disables the retry logic. <code>MERGE_RETRY_SLEEP</code> sets the time to sleep between retries, in milliseconds. The default is <code>5000</code> (5 seconds) and setting it to <code>0</code> disables sleeping between retries.</li><li><code>MERGE_DELETE_BRANCH</code>: Automatic deletion of branches does not work for all repositories. Set this option to <code>true</code> to automatically delete branches after they have been merged. The default value is <code>false</code>.</li></ul><p>The following update options are supported:</p><ul><li><code>UPDATE_LABELS</code>: The labels that need to be present for a pull request to be updated (using <code>UPDATE_METHOD</code>). The default value is <code>automerge</code>. Note that updating will only happen when the option “Require branches to be up to date before merging” is enabled in the branch protection rules. This option can be a comma-separated list of labels, see the <code>MERGE_LABELS</code> option for more information.</li><li><code>UPDATE_METHOD</code>: Which method to use when updating the pull request to the base branch. Possible values are <code>merge</code> (create a merge commit) or <code>rebase</code> (rebase the branch onto the head of the base branch). The default option is <code>merge</code>. When the option is <code>rebase</code> and the <a target="_blank" rel="noopener external nofollow noreferrer" href="https://git-scm.com/book/en/v2/Git-Branching-Rebasing">rebasing</a> failed, the action will exit with error code 1. This will also be visible in the pull request page, with a message like “this branch has conflicts that must be resolved” and a list of conflicting files.</li><li><code>UPDATE_RETRIES</code> and <code>UPDATE_RETRY_SLEEP</code>: Sometimes, the pull request check runs haven’t finished yet and the action doesn’t know if an update is necessary. To query the pull request state multiple times, the number of retries can be set with <code>UPDATE_RETRIES</code>. The default number of retries is <code>1</code> and setting it to <code>0</code> disables the retry logic. <code>UPDATE_RETRY_SLEEP</code> sets the time to sleep between retries, in milliseconds. The default is <code>5000</code> (5 seconds) and setting it to <code>0</code> disables sleeping between retries.</li></ul><p>Also, the following general options are supported:</p><ul><li><code>GITHUB_TOKEN</code>: This should always be <code>&quot;$&#123;&#123; secrets.GITHUB_TOKEN &#125;&#125;&quot;</code>. However, in some cases it can be useful to run this action as a certain user (by default, it will run as <code>github-actions</code>). This can be useful if you want to use the “Restrict who can push to matching branches” option in the branch protection rules, for example. To use this setting for manually providing a token, you need to create a <a target="_blank" rel="noopener external nofollow noreferrer" href="https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line">personal access token</a> for the user (make sure to check <code>public_repo</code> when it’s a public repository or <code>repo</code> when it’s a private repository). All API requests (merge/rebase) will then be executed as the specified user. The token should be kept secret, so make sure to add it as secret, not as environment variable, in the GitHub workflow file!</li></ul><p>You can configure the environment variables in the workflow file like this:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">env:</span></span><br><span class="line">  <span class="attr">GITHUB_TOKEN:</span> <span class="string">&quot;$<span class="template-variable">&#123;&#123; secrets.GITHUB_TOKEN &#125;&#125;</span>&quot;</span></span><br><span class="line">  <span class="attr">MERGE_LABELS:</span> <span class="string">&quot;automerge,!work in progress&quot;</span></span><br><span class="line">  <span class="attr">MERGE_REMOVE_LABELS:</span> <span class="string">&quot;automerge&quot;</span></span><br><span class="line">  <span class="attr">MERGE_METHOD:</span> <span class="string">&quot;squash&quot;</span></span><br><span class="line">  <span class="attr">MERGE_COMMIT_MESSAGE:</span> <span class="string">&quot;pull-request-description&quot;</span></span><br><span class="line">  <span class="attr">MERGE_FORKS:</span> <span class="string">&quot;false&quot;</span></span><br><span class="line">  <span class="attr">MERGE_RETRIES:</span> <span class="string">&quot;6&quot;</span></span><br><span class="line">  <span class="attr">MERGE_RETRY_SLEEP:</span> <span class="string">&quot;10000&quot;</span></span><br><span class="line">  <span class="attr">UPDATE_LABELS:</span> <span class="string">&quot;&quot;</span></span><br><span class="line">  <span class="attr">UPDATE_METHOD:</span> <span class="string">&quot;rebase&quot;</span></span><br></pre></td></tr></table></figure><h2 id="Supported-Events">Supported Events<a class="fa-solid fa-hashtag" href="#Supported-Events"></a></h2><p>Automerge can be configured to run for these events:</p><ul><li><code>check_run</code></li><li><code>check_suite</code></li><li><code>issue_comment</code></li><li><code>pull_request_review</code></li><li><code>pull_request_target</code></li><li><code>pull_request</code></li><li><code>push</code></li><li><code>repository_dispatch</code></li><li><code>schedule</code></li><li><code>status</code></li><li><code>workflow_dispatch</code></li></ul><p>For more information on when these occur, see the Github documentation on <a target="_blank" rel="noopener external nofollow noreferrer" href="https://docs.github.com/en/actions/reference/events-that-trigger-workflows">events that trigger workflows</a> and <a target="_blank" rel="noopener external nofollow noreferrer" href="https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads">their payloads</a>.</p><h2 id="Limitations">Limitations<a class="fa-solid fa-hashtag" href="#Limitations"></a></h2><ul><li>When a pull request is merged by this action, the merge will not trigger other GitHub workflows. Similarly, when another GitHub workflow creates a pull request, this action will not be triggered. This is because <a target="_blank" rel="noopener external nofollow noreferrer" href="https://help.github.com/en/actions/automating-your-workflow-with-github-actions/events-that-trigger-workflows">an action in a workflow run can’t trigger a new workflow run</a>. However, the <code>[workflow_run](https://docs.github.com/en/free-pro-team@latest/actions/reference/events-that-trigger-workflows#workflow_run)</code> event is triggered as expected.</li><li>When <a target="_blank" rel="noopener external nofollow noreferrer" href="https://help.github.com/en/actions/reference/events-that-trigger-workflows#triggering-new-workflows-using-a-personal-access-token">using a personal access token (PAT) to work around the above limitation</a>, note that when the user issuing the PAT is an administrator and <a target="_blank" rel="noopener external nofollow noreferrer" href="https://help.github.com/en/github/administering-a-repository/enabling-branch-restrictions">branch restrictions do not include administrators</a>, pull requests may be merged even if they are not mergeable for non-administrators (see <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/pascalgn/automerge-action/issues/65">#65</a>).</li><li>Currently, there is no way to trigger workflows when the pull request branch becomes out of date with the base branch. There is a request in the <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.community/t5/GitHub-Actions/New-Trigger-is-mergable-state/m-p/36908">GitHub community forum</a>.</li></ul><h2 id="Debugging">Debugging<a class="fa-solid fa-hashtag" href="#Debugging"></a></h2><p>To run the action with full debug logging, update your workflow file as follows:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">- name: automerge</span><br><span class="line">  uses: pascalgn/automerge-action@...</span><br><span class="line">  with:</span><br><span class="line">    args: &quot;--trace&quot;</span><br></pre></td></tr></table></figure><p>If you need to further debug the action, you can run it locally.</p><p>You will need a <a target="_blank" rel="noopener external nofollow noreferrer" href="https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line">personal access token</a>.</p><p>Then clone this repository, create a file <code>.env</code> in the repository, such as:</p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">GITHUB_TOKEN=&quot;123abc...&quot;</span><br><span class="line">URL=&quot;https://github.com/pascalgn/repository-name/pull/123&quot;</span><br></pre></td></tr></table></figure><p>Install dependencies with <code>yarn</code>, and finally run <code>yarn it</code> (or <code>npm run it</code>).</p><h2 id="License">License<a class="fa-solid fa-hashtag" href="#License"></a></h2><p><a href="LICENSE">MIT</a></p><h1>bulldozer</h1><p><img src= "" data-lazy-src="https://cdn.nlark.com/yuque/0/2021/svg/8391407/1610874951039-f74d3099-f28f-4856-ade7-6c677ce4869d.svg#height=20&amp;id=oob8t&amp;originHeight=20&amp;originWidth=110&amp;originalType=binary&amp;ratio=1&amp;rotation=0&amp;showTitle=false&amp;size=0&amp;status=done&amp;style=none&amp;title=&amp;width=110" alt="" loading="lazy"> <img src= "" data-lazy-src="https://img.shields.io/docker/pulls/palantirtechnologies/bulldozer.svg#height=19&amp;id=FEtmj&amp;originHeight=20&amp;originWidth=114&amp;originalType=binary&amp;ratio=1&amp;rotation=0&amp;showTitle=false&amp;status=done&amp;style=none&amp;title=&amp;width=108" alt="" loading="lazy"></p><p><code>bulldozer</code> is a <a target="_blank" rel="noopener external nofollow noreferrer" href="https://developer.github.com/apps/">GitHub App</a> that automatically merges pull requests (PRs) when (and only when) all required status checks are successful and required reviews are provided.</p><p>Additionally, <code>bulldozer</code> can:</p><ul><li>Only merge pull requests that match certain conditions, like having a specific label or comment</li><li>Ignore pull requests that match certain conditions, like having a specific label or comment</li><li>Automatically keep pull request branches up-to-date by merging in the target branch</li><li>Wait for additional status checks that are not required by GitHub</li></ul><p>Bulldozer might be useful if you:</p><ul><li>Have CI builds that take longer than the normal review process. It will merge reviewed PRs as soon as the tests pass so you don’t have to watch the pull request or remember to merge it later.</li><li>Combine it with <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/palantir/policy-bot">policy-bot</a> to automatically merge certain types of pre-approved or automated changes.</li><li>Want to give contributors more control over when they can merge PRs without granting them write access to the repository.</li><li>Have a lot of active development that makes it difficult to merge a pull request while it is up-to-date with the target branch.</li></ul><h2 id="Contents">Contents<a class="fa-solid fa-hashtag" href="#Contents"></a></h2><ul><li><a href="#behavior">Behavior</a></li><li><a href="#configuration">Configuration</a><ul><li><a href="#bulldozeryml-specification">bulldozer.yml Specification</a></li></ul></li><li><a href="#faq">FAQ</a></li><li><a href="#deployment">Deployment</a></li><li><a href="#development">Development</a></li><li><a href="#contributing">Contributing</a></li><li><a href="#license">License</a></li></ul><h2 id="Behavior">Behavior<a class="fa-solid fa-hashtag" href="#Behavior"></a></h2><p><code>bulldozer</code> will only merge pull requests that GitHub allows non-admin collaborators to merge. This means that all branch protection settings, including required status checks and required reviews, are respected. It also means that you <em>must</em> enable branch protection to prevent <code>bulldozer</code> from immediately merging every pull request.</p><p>Only pull requests matching the trigger conditions (or <em>not</em> matching ignore conditions) are considered for merging. <code>bulldozer</code> is event-driven, which means it will usually merge a pull request within a few seconds of the pull request satisfying all preconditions.</p><h2 id="Configuration-2">Configuration<a class="fa-solid fa-hashtag" href="#Configuration-2"></a></h2><p>The behavior of the bot is configured by a <code>.bulldozer.yml</code> file at the root of the repository. The file name and location are configurable when running your own instance of the server.</p><p>The <code>.bulldozer.yml</code> file is read from the most recent commit on the target branch of each pull request. If <code>bulldozer</code> cannot find a configuration file, it will take no action. This means it is safe to enable the <code>bulldozer</code> on all repositories in an organization.</p><h3 id="bulldozer-yml-Specification">bulldozer.yml Specification<a class="fa-solid fa-hashtag" href="#bulldozer-yml-Specification"></a></h3><p>The <code>.bulldozer.yml</code> file supports the following keys.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br></pre></td><td class="code"><pre><span class="line"><span class="comment"># &quot;version&quot; is the configuration version, currently &quot;1&quot;.</span></span><br><span class="line"><span class="attr">version:</span> <span class="number">1</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># &quot;merge&quot; defines how and when pull requests are merged. If the section is</span></span><br><span class="line"><span class="comment"># missing, bulldozer will consider all pull requests and use default settings.</span></span><br><span class="line"><span class="attr">merge:</span></span><br><span class="line">  <span class="comment"># &quot;trigger&quot; defines the set of pull requests considered by bulldozer. If</span></span><br><span class="line">  <span class="comment"># the section is missing, bulldozer considers all pull requests not excluded</span></span><br><span class="line">  <span class="comment"># by the ignore conditions.</span></span><br><span class="line">  <span class="attr">trigger:</span></span><br><span class="line">    <span class="comment"># Pull requests with any of these labels (case-insensitive) are added to</span></span><br><span class="line">    <span class="comment"># the trigger.</span></span><br><span class="line">    <span class="attr">labels:</span> [<span class="string">&quot;merge when ready&quot;</span>]</span><br><span class="line"></span><br><span class="line">    <span class="comment"># Pull requests where the body or any comment contains any of these</span></span><br><span class="line">    <span class="comment"># substrings are added to the trigger.</span></span><br><span class="line">    <span class="attr">comment_substrings:</span> [<span class="string">&quot;==MERGE_WHEN_READY==&quot;</span>]</span><br><span class="line"></span><br><span class="line">    <span class="comment"># Pull requests where any comment matches one of these exact strings are</span></span><br><span class="line">    <span class="comment"># added to the trigger.</span></span><br><span class="line">    <span class="attr">comments:</span> [<span class="string">&quot;Please merge this pull request!&quot;</span>]</span><br><span class="line"></span><br><span class="line">    <span class="comment"># Pull requests where the body contains any of these substrings are added</span></span><br><span class="line">    <span class="comment"># to the trigger.</span></span><br><span class="line">    <span class="attr">pr_body_substrings:</span> [<span class="string">&quot;==MERGE_WHEN_READY==&quot;</span>]</span><br><span class="line"></span><br><span class="line">    <span class="comment"># Pull requests targeting any of these branches are added to the trigger.</span></span><br><span class="line">    <span class="attr">branches:</span> [<span class="string">&quot;develop&quot;</span>]</span><br><span class="line"></span><br><span class="line">    <span class="comment"># Pull requests targeting branches matching any of these regular expressions are added to the trigger.</span></span><br><span class="line">    <span class="attr">branch_patterns:</span> [<span class="string">&quot;feature/.*&quot;</span>]</span><br><span class="line"></span><br><span class="line">  <span class="comment"># &quot;ignore&quot; defines the set of pull request ignored by bulldozer. If the</span></span><br><span class="line">  <span class="comment"># section is missing, bulldozer considers all pull requests. It takes the</span></span><br><span class="line">  <span class="comment"># same keys as the &quot;trigger&quot; section.</span></span><br><span class="line">  <span class="attr">ignore:</span></span><br><span class="line">    <span class="attr">labels:</span> [<span class="string">&quot;do not merge&quot;</span>]</span><br><span class="line">    <span class="attr">comment_substrings:</span> [<span class="string">&quot;==DO_NOT_MERGE==&quot;</span>]</span><br><span class="line"></span><br><span class="line">  <span class="comment"># &quot;method&quot; defines the merge method. The available options are &quot;merge&quot;,</span></span><br><span class="line">  <span class="comment"># &quot;rebase&quot;, &quot;squash&quot;, and &quot;ff-only&quot;.</span></span><br><span class="line">  <span class="attr">method:</span> <span class="string">squash</span></span><br><span class="line"></span><br><span class="line">  <span class="comment"># Allows the merge method that is used when auto-merging a PR to be different based on the</span></span><br><span class="line">  <span class="comment"># target branch. The keys of the hash are the target branch name, and the values are the merge method that</span></span><br><span class="line">  <span class="comment"># will be used for PRs targeting that branch. The valid values are the same as for the &quot;method&quot; key.</span></span><br><span class="line">  <span class="comment"># <span class="doctag">Note:</span> If the target branch does not match any of the specified keys, the &quot;method&quot; key is used instead.</span></span><br><span class="line">  <span class="attr">branch_method:</span></span><br><span class="line">    <span class="attr">develop:</span> <span class="string">squash</span></span><br><span class="line">    <span class="attr">master:</span> <span class="string">merge</span></span><br><span class="line"></span><br><span class="line">  <span class="comment"># &quot;options&quot; defines additional options for the individual merge methods.</span></span><br><span class="line">  <span class="attr">options:</span></span><br><span class="line">    <span class="comment"># &quot;squash&quot; options are only used when the merge method is &quot;squash&quot;</span></span><br><span class="line">    <span class="attr">squash:</span></span><br><span class="line">      <span class="comment"># &quot;title&quot; defines how the title of the commit message is created when</span></span><br><span class="line">      <span class="comment"># generating a squash commit. The options are &quot;pull_request_title&quot;,</span></span><br><span class="line">      <span class="comment"># &quot;first_commit_title&quot;, and &quot;github_default_title&quot;. The default is</span></span><br><span class="line">      <span class="comment"># &quot;pull_request_title&quot;.</span></span><br><span class="line">      <span class="attr">title:</span> <span class="string">&quot;pull_request_title&quot;</span></span><br><span class="line"></span><br><span class="line">      <span class="comment"># &quot;body&quot; defines how the body of the commit message is created when</span></span><br><span class="line">      <span class="comment"># generating a squash commit. The options are &quot;pull_request_body&quot;,</span></span><br><span class="line">      <span class="comment"># &quot;summarize_commits&quot;, and &quot;empty_body&quot;. The default is &quot;empty_body&quot;.</span></span><br><span class="line">      <span class="attr">body:</span> <span class="string">&quot;empty_body&quot;</span></span><br><span class="line"></span><br><span class="line">      <span class="comment"># If &quot;body&quot; is &quot;pull_request_body&quot;, then the commit message will be the</span></span><br><span class="line">      <span class="comment"># part of the pull request body surrounded by &quot;message_delimiter&quot;</span></span><br><span class="line">      <span class="comment"># strings. This is disabled (empty string) by default.</span></span><br><span class="line">      <span class="attr">message_delimiter:</span> <span class="string">==COMMIT_MSG==</span></span><br><span class="line"></span><br><span class="line">  <span class="comment"># &quot;required_statuses&quot; is a list of additional status contexts that must pass</span></span><br><span class="line">  <span class="comment"># before bulldozer can merge a pull request. This is useful if you want to</span></span><br><span class="line">  <span class="comment"># require extra testing for automated merges, but not for manual merges.</span></span><br><span class="line">  <span class="attr">required_statuses:</span></span><br><span class="line">    <span class="bullet">-</span> <span class="string">&quot;ci/circleci: ete-tests&quot;</span></span><br><span class="line"></span><br><span class="line">  <span class="comment"># If true, bulldozer will delete branches after their pull requests merge.</span></span><br><span class="line">  <span class="attr">delete_after_merge:</span> <span class="literal">true</span></span><br><span class="line"></span><br><span class="line"><span class="comment"># &quot;update&quot; defines how and when to update pull request branches. Unlike with</span></span><br><span class="line"><span class="comment"># merges, if this section is missing, bulldozer will not update any pull requests.</span></span><br><span class="line"><span class="attr">update:</span></span><br><span class="line">  <span class="comment"># &quot;trigger&quot; defines the set of pull requests that should be updated by</span></span><br><span class="line">  <span class="comment"># bulldozer. It accepts the same keys as the trigger in the &quot;merge&quot; block.</span></span><br><span class="line">  <span class="attr">trigger:</span></span><br><span class="line">    <span class="attr">labels:</span> [<span class="string">&quot;WIP&quot;</span>, <span class="string">&quot;Update Me&quot;</span>]</span><br><span class="line"></span><br><span class="line">  <span class="comment"># &quot;ignore&quot; defines the set of pull requests that should not be updated by</span></span><br><span class="line">  <span class="comment"># bulldozer. It accepts the same keys as the ignore in the &quot;merge&quot; block.</span></span><br><span class="line">  <span class="attr">ignore:</span></span><br><span class="line">    <span class="attr">labels:</span> [<span class="string">&quot;Do Not Update&quot;</span>]</span><br></pre></td></tr></table></figure><h2 id="FAQ">FAQ<a class="fa-solid fa-hashtag" href="#FAQ"></a></h2><h4 id="Can-I-specify-both-ignore-and-trigger">Can I specify both <code>ignore</code> and <code>trigger</code>?<a class="fa-solid fa-hashtag" href="#Can-I-specify-both-ignore-and-trigger"></a></h4><p>Yes. If both <code>ignore</code> and <code>trigger</code> are specified, bulldozer will attempt to match on both. In cases where both match, <code>ignore</code> will take precedence.</p><h4 id="Can-I-specify-the-body-of-the-commit-when-using-the-squash-strategy">Can I specify the body of the commit when using the <code>squash</code> strategy?<a class="fa-solid fa-hashtag" href="#Can-I-specify-the-body-of-the-commit-when-using-the-squash-strategy"></a></h4><p>Yes. When the merge strategy is <code>squash</code>, you can set additional options under the <code>options.squash</code> property, including how to render the commit body.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">merge:</span></span><br><span class="line">  <span class="attr">method:</span> <span class="string">squash</span></span><br><span class="line">  <span class="attr">options:</span></span><br><span class="line">    <span class="attr">squash:</span></span><br><span class="line">      <span class="attr">body:</span> <span class="string">summarize_commits</span> <span class="comment"># or `pull_request_body`, `empty_body`</span></span><br></pre></td></tr></table></figure><p>You can also define part of pull request body to pick as a commit message when <code>body</code> is <code>pull_request_body</code>.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">merge:</span></span><br><span class="line">  <span class="attr">method:</span> <span class="string">squash</span></span><br><span class="line">  <span class="attr">options:</span></span><br><span class="line">    <span class="attr">squash:</span></span><br><span class="line">      <span class="attr">body:</span> <span class="string">pull_request_body</span></span><br><span class="line">      <span class="attr">message_delimiter:</span> <span class="string">==COMMIT_MSG==</span></span><br></pre></td></tr></table></figure><p>Anything that’s contained between two <code>==COMMIT_MSG==</code> strings will become the commit message instead of whole pull request body.</p><h4 id="What-if-I-don’t-want-to-put-config-files-into-each-repo">What if I don’t want to put config files into each repo?<a class="fa-solid fa-hashtag" href="#What-if-I-don’t-want-to-put-config-files-into-each-repo"></a></h4><p>You can add default repository configuration in your bulldozer config file.</p><p>It will be used only when your repo config file does not exist.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">options:</span></span><br><span class="line">  <span class="attr">default_repository_config:</span></span><br><span class="line">    <span class="attr">ignore:</span></span><br><span class="line">      <span class="attr">labels:</span> [<span class="string">&quot;do not merge&quot;</span>] <span class="comment"># or any other available config.</span></span><br></pre></td></tr></table></figure><h4 id="Bulldozer-isn’t-merging-my-commit-when-it-should-what-could-be-happening">Bulldozer isn’t merging my commit when it should, what could be happening?<a class="fa-solid fa-hashtag" href="#Bulldozer-isn’t-merging-my-commit-when-it-should-what-could-be-happening"></a></h4><p>Bulldozer will attempt to merge a branch whenever it passes the trigger/ignore criteria. GitHub may prevent it from merging a branch in certain conditions, some of which are to be expected, and others that may be caused by mis-configuring Bulldozer.</p><ul><li>Required status checks have not passed</li><li>Review requirements are not satisfied</li><li>The merge strategy configured in <code>.bulldozer.yml</code> is not allowed by your repository settings</li><li>Branch protection rules are preventing <code>bulldozer[bot]</code> from <a target="_blank" rel="noopener external nofollow noreferrer" href="https://help.github.com/articles/about-branch-restrictions/">pushing to the branch</a>. Github apps can be added to the list of restricted push users, so you can allow Bulldozer specifically for your repo.</li></ul><h4 id="Bulldozer-isn’t-updating-my-branch-when-it-should-what-could-be-happening">Bulldozer isn’t updating my branch when it should, what could be happening?<a class="fa-solid fa-hashtag" href="#Bulldozer-isn’t-updating-my-branch-when-it-should-what-could-be-happening"></a></h4><p>When using the branch update functionality, Bulldozer only acts when the target branch is updated <em>after</em> updates are enabled for the pull request. For example:</p><ol><li>User A opens a pull request targetting <code>develop</code></li><li>User B pushes a commit to <code>develop</code></li><li>User A adds the <code>update me</code> label to the first pull request</li><li>User C pushes a commit to <code>develop</code></li><li>Bulldozer updates the pull request with the commits from Users B and C</li></ol><p>Note that the update does <em>not</em> happen when the <code>update me</code> label is added, even though there is a new commit on <code>develop</code> that is not part of the pull request.</p><h4 id="Can-Bulldozer-work-with-push-restrictions-on-branches">Can Bulldozer work with push restrictions on branches?<a class="fa-solid fa-hashtag" href="#Can-Bulldozer-work-with-push-restrictions-on-branches"></a></h4><p>As mentioned above, as of Github ~2.19.x, GitHub Apps <em>can</em> be added to the list of users associated with <a target="_blank" rel="noopener external nofollow noreferrer" href="https://help.github.com/articles/about-branch-restrictions/">push restrictions</a>. If you don’t want to do this, or if you’re running an older version of Github that doesn’t support this behaviour, you may work around this:</p><ol><li>Use another app like <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/palantir/policy-bot">policy-bot</a> to implement <em>approval</em> restrictions as required status checks instead of using push restrictions. This effectively limits who can push to a branch by requiring changes to go through the pull request process and be approved.</li><li>Configure Bulldozer to use a personal access token for a regular user to perform merges in this case. The token must have the <code>repo</code> scope and the user must be allowed to push to the branch. In the server configuration file, set:</li></ol><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">options:</span></span><br><span class="line">  <span class="attr">push_restriction_user_token:</span> <span class="string">&lt;token-value&gt;</span></span><br></pre></td></tr></table></figure><ol start="2"><li>The token is <em>only</em> used if the target branch has push restrictions enabled. All other merges are performed as the normal GitHub App user.</li></ol><h2 id="Deployment">Deployment<a class="fa-solid fa-hashtag" href="#Deployment"></a></h2><p>bulldozer is easy to deploy in your own environment as it has no dependencies other than GitHub. It is also safe to run multiple instances of the server, making it a good fit for container schedulers like Nomad or Kubernetes.</p><p>We provide both a Docker container and a binary distribution of the server:</p><ul><li>Binaries: <a target="_blank" rel="noopener external nofollow noreferrer" href="https://bintray.com/palantir/releases/bulldozer">https://bintray.com/palantir/releases/bulldozer</a></li><li>Docker Images: <a target="_blank" rel="noopener external nofollow noreferrer" href="https://hub.docker.com/r/palantirtechnologies/bulldozer/">https://hub.docker.com/r/palantirtechnologies/bulldozer/</a></li></ul><p>A sample configuration file is provided at <code>config/bulldozer.example.yml</code>. Certain values may also be set by environment variables; these are noted in the comments in the sample configuration file.</p><h3 id="GitHub-App-Configuration">GitHub App Configuration<a class="fa-solid fa-hashtag" href="#GitHub-App-Configuration"></a></h3><p>To configure Bulldozer as a GitHub App, these general options are required:</p><ul><li><strong>Webhook URL</strong>: <code>http(s)://&lt;your-bulldozer-domain&gt;/api/github/hook</code></li><li><strong>Webhook secret</strong>: A random string that matches the value of the <code>github.app.webhook_secret</code> property in the server configuration</li></ul><p>The app requires these permissions:</p><table><thead><tr><th>Permission</th><th>Access</th><th>Reason</th></tr></thead><tbody><tr><td>Repository administration</td><td>Read-only</td><td>Determine required status checks</td></tr><tr><td>Checks</td><td>Read-only</td><td>Read checks for ref</td></tr><tr><td>Repository contents</td><td>Read &amp; write</td><td>Read configuration, perform merges</td></tr><tr><td>Issues</td><td>Read &amp; write</td><td>Read comments, close linked issues</td></tr><tr><td>Repository metadata</td><td>Read-only</td><td>Basic repository data</td></tr><tr><td>Pull requests</td><td>Read &amp; write</td><td>Merge and close pull requests</td></tr><tr><td>Commit status</td><td>Read-only</td><td>Evaluate pull request status</td></tr></tbody></table><p>The app should be subscribed to these events:</p><ul><li>Check run</li><li>Commit comment</li><li>Pull request</li><li>Status</li><li>Push</li><li>Issue comment</li><li>Pull request review</li><li>Pull request review comment</li></ul><h3 id="Operations">Operations<a class="fa-solid fa-hashtag" href="#Operations"></a></h3><p>bulldozer uses <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/palantir/go-baseapp">go-baseapp</a> and <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/palantir/go-githubapp">go-githubapp</a>, both of which emit standard metrics and structured log keys. Please see those projects for details.</p><h3 id="Example-Files">Example Files<a class="fa-solid fa-hashtag" href="#Example-Files"></a></h3><p>Example <code>.bulldozer.yml</code> files can be found in <code>[config/examples](https://github.com/palantir/bulldozer/tree/develop/config/examples)</code></p><h3 id="Migrating-Version-0-4-X-to-1-X">Migrating: Version 0.4.X to 1.X<a class="fa-solid fa-hashtag" href="#Migrating-Version-0-4-X-to-1-X"></a></h3><p>The server configuration for bulldozer allows you to specify <code>configuration_v0_path</code>, which is a list of paths to check for <code>0.4.X</code> style bulldozer configuration. When a <code>1.X</code> style configuration file does not appear at the configured path, bulldozer will attempt to read from the paths configured by <code>configuration_v0_path</code>, converting the legacy configuration into an equivalent <code>v1</code> configuration internally.</p><p>The upgrade process is therefore to deploy the latest version of bulldozer with both <code>configuration_path</code> and <code>configuration_v0_path</code> configured, and to enable the bulldozer GitHub App on all organizations where it was previously installed.</p><h2 id="Development">Development<a class="fa-solid fa-hashtag" href="#Development"></a></h2><p>To develop <code>bulldozer</code>, you will need a <a target="_blank" rel="noopener external nofollow noreferrer" href="https://golang.org/doc/install">Go installation</a>.</p><p><strong>Run style checks and tests</strong></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">./godelw verify</span><br></pre></td></tr></table></figure><p><strong>Running the server locally</strong></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"># copy and edit the server config</span><br><span class="line">cp config/bulldozer.example.yml config/bulldozer.yml</span><br><span class="line"></span><br><span class="line">./godelw run bulldozer server</span><br></pre></td></tr></table></figure><ul><li><code>config/bulldozer.yml</code> is used as the default configuration file</li><li>The server is available at <code>http://localhost:8080/</code></li></ul><p><strong>Running the server via Docker</strong></p><figure class="highlight plaintext"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"># copy and edit the server config</span><br><span class="line">cp config/bulldozer.example.yml config/bulldozer.yml</span><br><span class="line"></span><br><span class="line"># build the docker image</span><br><span class="line">./godelw docker build --verbose</span><br><span class="line"></span><br><span class="line">docker run --rm -v &quot;$(pwd)/config:/secrets/&quot; -p 8080:8080 palantirtechnologies/bulldozer:latest</span><br></pre></td></tr></table></figure><ul><li>This mounts the <code>config</code> directory (which should contain the <code>bulldozer.yml</code> configuration file) at the expected location</li><li>The server is available at <code>http://localhost:8080/</code></li></ul><h2 id="Contributing">Contributing<a class="fa-solid fa-hashtag" href="#Contributing"></a></h2><p>Contributions and issues are welcome. For new features or large contributions, we prefer discussing the proposed change on a GitHub issue prior to a PR.</p><h2 id="License-2">License<a class="fa-solid fa-hashtag" href="#License-2"></a></h2><p>This application is made available under the <a target="_blank" rel="noopener external nofollow noreferrer" href="http://www.apache.org/licenses/LICENSE-2.0">Apache 2.0 License</a>.</p><h1>probot-auto-merge</h1><p><img src= "" data-lazy-src="https://travis-ci.org/bobvanderlinden/probot-auto-merge.svg?branch=master#height=20&amp;id=aSSyK&amp;originHeight=20&amp;originWidth=90&amp;originalType=binary&amp;ratio=1&amp;rotation=0&amp;showTitle=false&amp;status=done&amp;style=none&amp;title=&amp;width=90" alt="" loading="lazy"> <img src= "" data-lazy-src="https://img.shields.io/coveralls/github/bobvanderlinden/probot-auto-merge.svg#height=20&amp;id=LDRWo&amp;originHeight=20&amp;originWidth=96&amp;originalType=binary&amp;ratio=1&amp;rotation=0&amp;showTitle=false&amp;status=done&amp;style=none&amp;title=&amp;width=96" alt="" loading="lazy"></p><p>A GitHub App built with <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/probot/probot">Probot</a> that automatically merges PRs</p><blockquote></blockquote><h2 id="Usage-2">Usage<a class="fa-solid fa-hashtag" href="#Usage-2"></a></h2><ol><li><a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/apps/probot-auto-merge">Configure the GitHub App</a></li><li>Create <code>.github/auto-merge.yml</code> in your repository.</li><li>Customize configuration to your needs. See below.</li></ol><h2 id="Configuration-3">Configuration<a class="fa-solid fa-hashtag" href="#Configuration-3"></a></h2><p>Configuration of <code>probot-auto-merge</code> is done through <code>.github/auto-merge.yml</code> in your repository. An example of this file can be found <a href="auto-merge.example.yml">here</a>. You can also see the configuration for this repository <a href=".github/auto-merge.yml">here</a>.</p><p>The configuration has values that serve as conditions on whether or not a pull request should be automatically merged and also configuration about the merge itself. Values that serve as conditions are annotated as such below.</p><p>All conditions must be met before a PR will be automatically merged. You can get more flexibility by defining multiple rules. Rules can have multiple conditions and if any of the conditions inside a rule are met, the PR is also merged. See <a href="#rules-default-none">rules</a>.</p><p>If the target branch is a protected branch, you must add <code>probot-auto-merge</code> bot to the list of <code>People, teams or apps with push access</code> in your branch protection rules.</p><p>Note that the default configuration options are to do nothing. This is to prevent implicit and possibly unintended behavior.</p><p>The configuration fields are as follows:</p><h3 id="minApprovals-required-condition"><code>minApprovals</code> (required, condition)<a class="fa-solid fa-hashtag" href="#minApprovals-required-condition"></a></h3><p>The minimum number of reviews from each association that approve the pull request before doing an automatic merge. For more information about associations see: <a target="_blank" rel="noopener external nofollow noreferrer" href="https://developer.github.com/v4/enum/commentauthorassociation/">https://developer.github.com/v4/enum/commentauthorassociation/</a></p><p>Possible associations: <code>OWNER</code>, <code>MEMBER</code>, <code>COLLABORATOR</code>, <code>CONTRIBUTOR</code>, <code>FIRST_TIMER</code>, <code>FIRST_TIME_CONTRIBUTOR</code>, <code>NONE</code></p><p>In the example below when a pull request gets 2 approvals from owners, members or collaborators, the automatic merge will continue.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">minApprovals:</span></span><br><span class="line">  <span class="attr">COLLABORATOR:</span> <span class="number">2</span></span><br></pre></td></tr></table></figure><p>In the example below when a pull request gets 1 approval from an owner OR 2 approvals from members, the automatic merge will continue.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">minApprovals:</span></span><br><span class="line">  <span class="attr">OWNER:</span> <span class="number">1</span></span><br><span class="line">  <span class="attr">MEMBER:</span> <span class="number">2</span></span><br></pre></td></tr></table></figure><h3 id="requiredReviewers-condition-default-none"><code>requiredReviewers</code> (condition, default: none)<a class="fa-solid fa-hashtag" href="#requiredReviewers-condition-default-none"></a></h3><p>Whenever required reviewers are configured, pull requests will only be automatically merged whenever all of these reviewers have approved the pull request.</p><p>In the example below, pull requests need to have been approved by the user ‘rogerluan’ before they will be automatically merged.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">requiredReviewers:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">rogerluan</span></span><br></pre></td></tr></table></figure><h3 id="maxRequestedChanges-condition-default-none"><code>maxRequestedChanges</code> (condition, default: none)<a class="fa-solid fa-hashtag" href="#maxRequestedChanges-condition-default-none"></a></h3><p>Similar to <code>minApprovals</code>, maxRequestedChanges determines the maximum number of requested changes before a pull request will be blocked from being automatically merged.</p><p>It yet again allows you to configure this per association.</p><p>Note that <code>maxRequestedChanges</code> takes precedence over <code>minApprovals</code>.</p><p>In the example below, automatic merges will be blocked when one of the owners, members or collaborators has requested changes.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">maxRequestedChanges:</span></span><br><span class="line">  <span class="attr">COLLABORATOR:</span> <span class="number">0</span></span><br></pre></td></tr></table></figure><p>In the example below, automatic merges will be blocked when the owner has requested changes or two members, collaborators or other users have requested changes.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">maxRequestedChanges:</span></span><br><span class="line">  <span class="attr">OWNER:</span> <span class="number">0</span></span><br><span class="line">  <span class="attr">NONE:</span> <span class="number">1</span></span><br></pre></td></tr></table></figure><p>The default for this value is:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">maxRequestedChanges:</span></span><br><span class="line">  <span class="attr">NONE:</span> <span class="number">0</span></span><br></pre></td></tr></table></figure><h3 id="blockingBaseBranches-condition-default-none"><code>blockingBaseBranches</code> (condition, default: none)<a class="fa-solid fa-hashtag" href="#blockingBaseBranches-condition-default-none"></a></h3><p>Whenever blocking base branches are configured, pull requests will only be automatically merged whenever their base branch (into which the PR would be merged) is not matching the patterns listed.</p><p>In the example below, pull requests that have the base branch <code>develop</code> or one that starts with <code>feature-</code> will not be merged automatically.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">blockingBaseBranches:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">develop</span></span><br><span class="line">  <span class="bullet">-</span> <span class="attr">regex:</span> <span class="string">^feature-</span></span><br></pre></td></tr></table></figure><p>Note: remove the whole section when you’re not using blocking base branches.</p><h3 id="requiredBaseBranches-condition-default-none"><code>requiredBaseBranches</code> (condition, default: none)<a class="fa-solid fa-hashtag" href="#requiredBaseBranches-condition-default-none"></a></h3><p>Whenever required base branches are configured, pull requests will only be automatically merged whenever their base branch (into which the PR would be merged) is matching any of the patterns listed.</p><p>In the example below, pull requests need to have the base branch <code>master</code> or one that starts with <code>v&#123;number&#125;</code> before they will be automatically merged.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">requiredBaseBranches:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">master</span></span><br><span class="line">  <span class="bullet">-</span> <span class="attr">regex:</span> <span class="string">^v\d</span></span><br></pre></td></tr></table></figure><h3 id="blockingLabels-condition-default-none"><code>blockingLabels</code> (condition, default: none)<a class="fa-solid fa-hashtag" href="#blockingLabels-condition-default-none"></a></h3><p>Blocking labels are the labels that can be attached to a pull request to make sure the pull request is not being merged automatically.</p><p>In the example below, pull requests that have the <code>blocked</code> label will not be merged automatically.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">blockingLabels:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">blocked</span></span><br></pre></td></tr></table></figure><p>The above example denotes literal label names. Regular expressions can be used to partially match labels. This can be specified by the <code>regex:</code> property in the configuration. The following example will block merging when a label is added that starts with the text <code>blocked</code>:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">blockingLabels:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="attr">regex:</span> <span class="string">^blocked</span></span><br></pre></td></tr></table></figure><p>Note: remove the whole section when you’re not using blocking labels.</p><h3 id="requiredLabels-condition-default-none"><code>requiredLabels</code> (condition, default: none)<a class="fa-solid fa-hashtag" href="#requiredLabels-condition-default-none"></a></h3><p>Whenever required labels are configured, pull requests will only be automatically merged whenever all of these labels are attached to a pull request.</p><p>In the example below, pull requests need to have the label <code>merge</code> before they will be automatically merged.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">requiredLabels:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">merge</span></span><br></pre></td></tr></table></figure><p>The above example denotes literal label names. Regular expressions can be used to partially match labels. This requires <code>regex:</code> property in the configuration. The following example will requires at least one label that starts with <code>merge</code>:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">requiredLabels:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="attr">regex:</span> <span class="string">^merge</span></span><br></pre></td></tr></table></figure><p>Note: remove the whole section when you’re not using required labels.</p><h3 id="blockingTitleRegex-condition-default-none"><code>blockingTitleRegex</code> (condition, default: none)<a class="fa-solid fa-hashtag" href="#blockingTitleRegex-condition-default-none"></a></h3><p>Whenever a blocking title regular expression is configured, pull requests that have a title matching the configured expression will not be automatically merged.</p><p>This is useful whenever pull requests with <code>WIP</code> in their title need to be skipped.</p><p>In the example below, pull requests with the word <code>wip</code> in the title will not be automatically merged. This also includes <code>[wip]</code>, <code>WIP</code> or <code>[WIP]</code>, but not <code>swiping</code>:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">blockingTitleRegex:</span> <span class="string">&#x27;\bWIP\b&#x27;</span></span><br></pre></td></tr></table></figure><h3 id="requiredTitleRegex-condition-default-none"><code>requiredTitleRegex</code> (condition, default: none)<a class="fa-solid fa-hashtag" href="#requiredTitleRegex-condition-default-none"></a></h3><p>Whenever a required title regular expression is configured, only pull requests that have a title matching the configured expression will automatically be merged.</p><p>This is useful for forks, that can only create pull request text, no labels.</p><p>In the example below, pull requests with the title containing <code>MERGE</code> will be automatically merged. This also includes This also includes <code>[merge]</code>, <code>MERGE</code> or <code>[MERGE]</code>, but not <code>submerge</code>:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">requiredTitleRegex:</span> <span class="string">&#x27;\bMERGE\b&#x27;</span></span><br></pre></td></tr></table></figure><h3 id="blockingBodyRegex-condition-default-none"><code>blockingBodyRegex</code> (condition, default: none)<a class="fa-solid fa-hashtag" href="#blockingBodyRegex-condition-default-none"></a></h3><p>Whenever a blocking body regular expression is configured, pull requests that have a body matching the configured expression will not be automatically merged.</p><p>This is useful whenever pull requests with a certain string in their body need to be skipped.</p><p>In the example below, pull requests with the body containing <code>do-not-merge</code> will not be automatically merged. This also includes <code>labels: do-not-merge</code>, <code>LABELS: DO-NOT-MERGE</code> or <code>some more text, but do-not-merge</code>, but not <code>do-not-merge-just-kidding</code>:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">blockingBodyRegex:</span> <span class="string">&#x27;(^|\\s)do-not-merge($|\\s)&#x27;</span></span><br></pre></td></tr></table></figure><h3 id="requiredBodyRegex-condition-default-none"><code>requiredBodyRegex</code> (condition, default: none)<a class="fa-solid fa-hashtag" href="#requiredBodyRegex-condition-default-none"></a></h3><p>Whenever a required body regular expression is configured, only pull requests that have a body matching the configured expression will automatically be merged.</p><p>This is useful for forks, that can only create pull request text, no labels.</p><p>In the example below, pull requests with the body containing <code>ok-to-merge</code> will be automatically merged. This also includes <code>labels: ok-to-merge</code>, <code>LABELS: OK-TO-MERGE</code> or <code>some more text, but ok-to-merge</code>, but not <code>not-ok-to-merge</code>:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">requiredBodyRegex:</span> <span class="string">&#x27;(^|\\s)ok-to-merge($|\\s)&#x27;</span></span><br></pre></td></tr></table></figure><h3 id="reportStatus-default-false"><code>reportStatus</code> (default: <code>false</code>)<a class="fa-solid fa-hashtag" href="#reportStatus-default-false"></a></h3><p>The status of the auto-merge process will be shown in each PR as a <a target="_blank" rel="noopener external nofollow noreferrer" href="https://help.github.com/articles/about-status-checks/">check</a>. This can be especially useful to find out why a PR is not being merged automatically.</p><p>To enable status reporting, add the following to your configuration:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">reportStatus:</span> <span class="literal">true</span></span><br></pre></td></tr></table></figure><h3 id="updateBranch-default-false"><code>updateBranch</code> (default: <code>false</code>)<a class="fa-solid fa-hashtag" href="#updateBranch-default-false"></a></h3><p>Whether an out-of-date pull request is automatically updated. It does so by merging its base on top of the head of the pull request. This is similar to the behavior of the ‘Update branch’ button.</p><p><code>updateBranch</code> is useful for repositories where protected branches are used and the option <em>Require branches to be up to date before merging</em> is enabled.</p><p>Note that this only works when the branch of the pull request resides in the same repository as the pull request itself.</p><p>In the example below automatic updating of branches is enabled:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">updateBranch:</span> <span class="literal">true</span></span><br></pre></td></tr></table></figure><h3 id="deleteBranchAfterMerge-default-false"><code>deleteBranchAfterMerge</code> (default: <code>false</code>)<a class="fa-solid fa-hashtag" href="#deleteBranchAfterMerge-default-false"></a></h3><p>Whether the pull request branch is automatically deleted. This is the equivalent of clicking the ‘Delete branch’ button shown on merged pull requests.</p><p>Note that this only works when the branch of the pull request resides in the same repository as the pull request itself.</p><p>In the example below automatic deletion of pull request branches is enabled:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">deleteBranchAfterMerge:</span> <span class="literal">true</span></span><br></pre></td></tr></table></figure><h3 id="mergeMethod-default-merge"><code>mergeMethod</code> (default: <code>merge</code>)<a class="fa-solid fa-hashtag" href="#mergeMethod-default-merge"></a></h3><p>In what way a pull request is merged. This can be:</p><ul><li><code>merge</code>: creates a merge commit, combining the commits from the pull request on top of the base of the pull request (default)</li><li><code>rebase</code>: places the commits from the pull request individually on top of the base of the pull request</li><li><code>squash</code>: combines all changes from the pull request into a single commit and places the commit on top of the base of the pull request</li></ul><p>For more information see <a target="_blank" rel="noopener external nofollow noreferrer" href="https://help.github.com/articles/about-pull-request-merges/">https://help.github.com/articles/about-pull-request-merges/</a></p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">mergeMethod:</span> <span class="string">merge</span></span><br></pre></td></tr></table></figure><h3 id="mergeCommitMessage-default-none"><code>mergeCommitMessage</code> (default: none)<a class="fa-solid fa-hashtag" href="#mergeCommitMessage-default-none"></a></h3><p>Optionally specify the merge commit message format. The following template tags are supported:</p><ul><li><code>&#123;title&#125;</code>: The pull request title at the moment it is merged</li><li><code>&#123;body&#125;</code>: The pull request body at the moment it is merged</li><li><code>&#123;number&#125;</code>: The pull request number</li><li><code>&#123;branch&#125;</code>: The name of the source branch</li><li><code>&#123;commits&#125;</code>: A list of merged commits</li></ul><p>When this option is not set, the merge commit message is controlled by GitHub and uses a combination of the title of the pull request when it was opened (note that later changes to the title are ignored) and a list of commits.</p><p>This settings is ignored when <code>mergeMethod</code> is set to <code>rebase</code>.</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">mergeCommitMessage:</span> <span class="string">|</span></span><br><span class="line"><span class="string">  &#123;title&#125; (#&#123;number&#125;)</span></span><br><span class="line"><span class="string">  &#123;body&#125;</span></span><br></pre></td></tr></table></figure><h3 id="rules-default-none"><code>rules</code> (default: none)<a class="fa-solid fa-hashtag" href="#rules-default-none"></a></h3><p>Rules allow more flexibility configuring conditions for automatically merging. Each rule is defined by multiple conditions. All conditions inside a rule must be met before a rule triggers a merge. Any of the defined rules can trigger a merge individually.</p><p>An example of a configuration with 2 rules that will trigger a merge upon 1 approval from an owner <em>or</em> a <code>merge</code> label:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">rules:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="attr">minApprovals:</span></span><br><span class="line">      <span class="attr">OWNER:</span> <span class="number">1</span></span><br><span class="line">  <span class="bullet">-</span> <span class="attr">requiredLabels:</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">merge</span></span><br></pre></td></tr></table></figure><p>This can be combined with conditions on global level, as the global conditions will take precedence. The following example will not trigger a merge when a PR has the <code>blocking</code> label, regardless what the rules say:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">blockingLabels:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="string">blocking</span></span><br><span class="line"><span class="attr">rules:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="attr">minApprovals:</span></span><br><span class="line">      <span class="attr">OWNER:</span> <span class="number">1</span></span><br><span class="line">  <span class="bullet">-</span> <span class="attr">requiredLabels:</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">merge</span></span><br></pre></td></tr></table></figure><p>Note: remove the whole rules section when you’re not using any rules.</p><h3 id="requiredAuthorRole-default-none"><code>requiredAuthorRole</code> (default: none)<a class="fa-solid fa-hashtag" href="#requiredAuthorRole-default-none"></a></h3><p>Using the <code>requiredAuthorRole</code> condition you can specify conditions based on the role of the pull request author. For instance, using <code>rules</code>, one can be more loose when the author is an owner, and more restrictive otherwise.</p><p>Here’s an example of a configuration that requires acceptance of 2 owners or 1 owner if the other owner made the PR:</p><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">rules:</span></span><br><span class="line">  <span class="bullet">-</span> <span class="attr">requiredAuthorRole:</span> <span class="string">OWNER</span></span><br><span class="line">    <span class="attr">minApprovals:</span></span><br><span class="line">      <span class="attr">OWNER:</span> <span class="number">1</span></span><br><span class="line">  <span class="bullet">-</span> <span class="attr">minApprovals:</span></span><br><span class="line">      <span class="attr">OWNER:</span> <span class="number">2</span></span><br></pre></td></tr></table></figure><h2 id="Development-2">Development<a class="fa-solid fa-hashtag" href="#Development-2"></a></h2><h3 id="Setup">Setup<a class="fa-solid fa-hashtag" href="#Setup"></a></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta prompt_"># </span><span class="language-bash">Install dependencies</span></span><br><span class="line">npm install</span><br><span class="line"><span class="meta prompt_"></span></span><br><span class="line"><span class="meta prompt_"># </span><span class="language-bash">Run typescript</span></span><br><span class="line">npm run build</span><br></pre></td></tr></table></figure><h3 id="Testing">Testing<a class="fa-solid fa-hashtag" href="#Testing"></a></h3><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm run test</span><br></pre></td></tr></table></figure><p>or during development:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm run test:watch</span><br></pre></td></tr></table></figure><h3 id="Running">Running<a class="fa-solid fa-hashtag" href="#Running"></a></h3><p>See <a target="_blank" rel="noopener external nofollow noreferrer" href="https://probot.github.io/docs/development/#configuring-a-github-app">https://probot.github.io/docs/development/#configuring-a-github-app</a></p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm run build &amp;&amp; npm run dev</span><br></pre></td></tr></table></figure><h3 id="Running-on-Docker">Running on Docker<a class="fa-solid fa-hashtag" href="#Running-on-Docker"></a></h3><p>This will build and run the app on a container called <code>probot-auto-merge</code>:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm run docker</span><br></pre></td></tr></table></figure><p>To just build the container image:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm run docker:build</span><br></pre></td></tr></table></figure><p>To run the built image:</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm run docker:run</span><br></pre></td></tr></table></figure><h3 id="Running-the-linter">Running the linter<a class="fa-solid fa-hashtag" href="#Running-the-linter"></a></h3><p>This will run the linter, pointing out the infractions, but it won’t fix them automatically.</p><figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><span class="line">npm run lint</span><br></pre></td></tr></table></figure><h2 id="Deployment-2">Deployment<a class="fa-solid fa-hashtag" href="#Deployment-2"></a></h2><p>To deploy <code>probot-auto-merge</code> yourself, please follow <a target="_blank" rel="noopener external nofollow noreferrer" href="https://probot.github.io/docs/deployment/">the guidelines defined by Probot on deploying GitHub applications</a>.</p><p>The permissions and events needed for the app to function can be found below.</p><h3 id="Permissions">Permissions<a class="fa-solid fa-hashtag" href="#Permissions"></a></h3><ul><li>Administration: Read-only</li><li>Checks: Read &amp; write</li><li>Contents: Read &amp; write</li><li>Issues: Read &amp; write</li><li>Metadata: Read-only</li><li>Pull requests: Read &amp; write</li><li>Commit statuses: Read-only</li><li>Members: Read-only</li></ul><h3 id="Events">Events<a class="fa-solid fa-hashtag" href="#Events"></a></h3><ul><li>Check run</li><li>Check suite</li><li>Label</li><li>Pull request</li><li>Pull request review</li><li>Pull request review comment</li><li>Status</li></ul><h2 id="Contributing-2">Contributing<a class="fa-solid fa-hashtag" href="#Contributing-2"></a></h2><p>If you have suggestions for how <code>probot-auto-merge</code> could be improved, or want to report a bug, open an issue! We’d love all and any contributions.</p><p>For more, check out the <a href="CONTRIBUTING.md">Contributing Guide</a>.</p><h2 id="License-3">License<a class="fa-solid fa-hashtag" href="#License-3"></a></h2><p><a href="LICENSE">ISC</a> © 2018 Bob van der Linden <a href="mailto:bobvanderlinden@gmail.com" rel="external nofollow noreferrer">bobvanderlinden@gmail.com</a> (<a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/bobvanderlinden/probot-auto-merge">https://github.com/bobvanderlinden/probot-auto-merge</a>)</p><h1>auto-label-merge-conflicts</h1><blockquote><p>A Github action to auto-label PRs with merge conflicts</p></blockquote><h2 id="Purpose">Purpose<a class="fa-solid fa-hashtag" href="#Purpose"></a></h2><p>This action checks all open Pull Requests for merge conflicts and marks them with a Github label.</p><p><img src= "" data-lazy-src="/./demo.png#id=IgY1W&amp;originalType=binary&amp;ratio=1&amp;rotation=0&amp;showTitle=false&amp;status=done&amp;style=none&amp;title=" alt="" loading="lazy"></p><p>Once a conflict is resolved the label is automatically removed.</p><p>The typical use case is to run this action post merge (e.g. push to <code>master</code>) to quickly see which other PRs are now in conflict.</p><p>We use this setup e.g. on our monorepo at <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/comtravo">Comtravo</a>. Instead of a grumpy CTO pinging developers to fix their merge conflicts there’s now a shiny bot.</p><h2 id="Set-up">Set up<a class="fa-solid fa-hashtag" href="#Set-up"></a></h2><p>To configure the action on your repo you have to do 2 things:</p><ol><li>pick a Github label that should be used to mark PRs with conflicts</li></ol><p>This label will then be managed by this action. It will be added to PRs with merge conflicts and removed from PRs without conflicts.</p><ol start="2"><li>configure the new workflow by creating a YML config file in your <code>.github/workflows</code> folder:</li></ol><figure class="highlight yaml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">on:</span></span><br><span class="line">  <span class="attr">push:</span></span><br><span class="line">    <span class="attr">branches:</span></span><br><span class="line">      <span class="bullet">-</span> <span class="string">master</span></span><br><span class="line"><span class="attr">jobs:</span></span><br><span class="line">  <span class="attr">triage:</span></span><br><span class="line">    <span class="attr">runs-on:</span> <span class="string">ubuntu-latest</span></span><br><span class="line">    <span class="attr">steps:</span></span><br><span class="line">      <span class="bullet">-</span> <span class="attr">uses:</span> <span class="string">mschilde/auto-label-merge-conflicts@master</span></span><br><span class="line">        <span class="attr">with:</span></span><br><span class="line">          <span class="attr">CONFLICT_LABEL_NAME:</span> <span class="string">&quot;has conflicts&quot;</span></span><br><span class="line">          <span class="attr">GITHUB_TOKEN:</span> <span class="string">$&#123;&#123;</span> <span class="string">secrets.GITHUB_TOKEN</span> <span class="string">&#125;&#125;</span></span><br><span class="line">          <span class="attr">MAX_RETRIES:</span> <span class="number">5</span></span><br><span class="line">          <span class="attr">WAIT_MS:</span> <span class="number">5000</span></span><br></pre></td></tr></table></figure><p>The label from step 1 should be referenced in the parameter <code>CONFLICT_LABEL_NAME</code></p><p>Take a look at <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/mschilde/auto-label-merge-conflicts/blob/master/%2Egithub/workflows/label_merge_conflicts.yml">this repo</a> for an example setup.</p><h3 id="Arguments">Arguments:<a class="fa-solid fa-hashtag" href="#Arguments"></a></h3><ul><li>MAX_RETRIES: optional (default 5)</li><li>WAIT_MS: optional (default 5000)</li></ul><h2 id="Limitations-2">Limitations<a class="fa-solid fa-hashtag" href="#Limitations-2"></a></h2><p>Github does not reliably compute the <code>mergeable</code> status which is used by this action to detect merge conflicts.</p><p>If <code>master</code> changes the mergeable status is unknown until someone (most likely this action) requests it. <a target="_blank" rel="noopener external nofollow noreferrer" href="https://stackoverflow.com/a/30620973">Github then tries to compute the status with an async job.</a></p><p>This is usually quick and simple, but there are no guarantees and Github might have issues. You can tweak <code>MAX_RETRIES</code> and <code>WAIT_MS</code> to increase the timeout before giving up on a Pull Request.</p><h2 id="Local-dev-setup">Local dev setup<a class="fa-solid fa-hashtag" href="#Local-dev-setup"></a></h2><p>To play around with the code base, you need <code>Docker</code> and <code>make</code> set up locally.</p><p>Run <code>make build</code>, <code>make develop</code>, then <code>yarn install</code>.</p><h1>How to use PR Valet</h1><p>Step 1: Install <a target="_blank" rel="noopener external nofollow noreferrer" href="https://github.com/marketplace/pr-valet">PR Valet</a>. Step 2: Add the <code>valet:merge</code> label to your pull request. Step 3: Work on your other tasks while PR Valet takes care of merging your pull request.</p><h1><a target="_blank" rel="noopener external nofollow noreferrer" href="https://docs.mergify.io/">https://docs.mergify.io/</a></h1><h1><a target="_blank" rel="noopener external nofollow noreferrer" href="https://snyk.io/">https://snyk.io/</a></h1></article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta"><i class="fas fa-circle-user fa-fw"></i>文章作者: </span><span class="post-copyright-info"><a href="https://blog.ccknbc.cc/">CC康纳百川</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta"><i class="fas fa-square-arrow-up-right fa-fw"></i>文章链接: </span><span class="post-copyright-info"><a href="https://blog.ccknbc.cc/posts/github-automatically-merges-pull-requests-notes/">https://blog.ccknbc.cc/posts/github-automatically-merges-pull-requests-notes/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta"><i class="fas fa-circle-exclamation fa-fw"></i>版权声明: </span><span class="post-copyright-info">本博客所有文章除特别声明外，均采用 <a target="_blank" rel="noopener external nofollow noreferrer" href="https://creativecommons.org/licenses/by-nc-sa/4.0/"><i style="color:#8fbc8f" class="fa-brands fa-creative-commons"></i> <i style="color:#8fbc8f" class="fa-brands fa-creative-commons-by"></i> <i style="color:#8fbc8f" class="fa-brands fa-creative-commons-nc"></i> <i style="color:#8fbc8f" class="fa-brands fa-creative-commons-sa"></i> CC BY-NC-SA 4.0</a> 许可协议。转载请注明来自 <a href="https://blog.ccknbc.cc">CC的部落格</a>！</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/%E5%B7%A5%E5%85%B7/">工具</a></div><div class="post_share"><div class="social-share" data-image="https://pic1.afdiancdn.com/user/8a7f563c2e3811ecab5852540025c377/common/75d33bcc96205123aa3a40aae776d793_w2560_h1440_s704.jpg" data-sites="wechat,weibo,qq,facebook,twitter"></div><link rel="stylesheet" href="https://jsd.cdn.zzko.cn/npm/butterfly-extsrc/sharejs/dist/css/share.min.css" media="print" onload='this.media="all"'><script src="https://jsd.cdn.zzko.cn/npm/butterfly-extsrc/sharejs/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button"><i class="fas fa-qrcode"></i>赞赏</div><div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://www.rocschool.com/tool/qr/qr/id/51.html" rel="external nofollow noreferrer" target="_blank"><img class="post-qr-code-img" src= "" data-lazy-src="https://jsd.cdn.zzko.cn/gh/ccknbc-backup/cdn/logo/qr.png" alt="三合一"></a><div class="post-qr-code-desc">三合一</div></li><li class="reward-item"><a href="https://afdian.net/@ccknbc" rel="external nofollow noreferrer" target="_blank"><img class="post-qr-code-img" src= "" data-lazy-src="https://jsd.cdn.zzko.cn/gh/ccknbc-backup/cdn/logo/afdian.png" alt="爱发电"></a><div class="post-qr-code-desc">爱发电</div></li></ul></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/posts/waline-comments-system-deployment-logs/" title="Waline 评论系统部署日志"><img class="cover" src= "" data-lazy-src="https://pic1.afdiancdn.com/user/8a7f563c2e3811ecab5852540025c377/common/edd977e4a8569283e89ac7426b67dfc3_w1920_h1080_s366.jpg" onerror='onerror=null,src="https://jsd.cdn.zzko.cn/npm/hexo-theme-anzhiyu/source/img/friend_404.gif"' alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Waline 评论系统部署日志</div></div></a></div><div class="next-post pull-right"><a href="/posts/introduction-of-plugin-tags-based-on-butterfly/" title="Hexo标签笔记"><img class="cover" src= "" data-lazy-src="https://pic1.afdiancdn.com/user/8a7f563c2e3811ecab5852540025c377/common/666ccfeb387717d69a0e3333cc1170dc_w1004_h591_s48.jpg" onerror='onerror=null,src="https://jsd.cdn.zzko.cn/npm/hexo-theme-anzhiyu/source/img/friend_404.gif"' alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">Hexo标签笔记</div></div></a></div></nav><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>相关推荐</span></div><div class="relatedPosts-list"><div><a href="/posts/hexo-webpushr-notification/" title="Hexo浏览器定向推送文章更新"><img class="cover" src= "" data-lazy-src="https://pic1.afdiancdn.com/user/8a7f563c2e3811ecab5852540025c377/common/d2a947d48815ed24936a919873b97841_w1366_h768_s31.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-10-05</div><div class="title">Hexo浏览器定向推送文章更新</div></div></a></div><div><a href="/posts/the-real-addthis/" title="你以为 AddThis 只是个分享工具吗？"><img class="cover" src= "" data-lazy-src="https://pic1.afdiancdn.com/user/8a7f563c2e3811ecab5852540025c377/common/bbf0970587cfd0f4a654efda9c375844_w1920_h1080_s216.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-05-15</div><div class="title">你以为 AddThis 只是个分享工具吗？</div></div></a></div><div><a href="/posts/hexo-butterfly-algolia/" title="Hexo Butterfly Algolia 搜索的使用"><img class="cover" src= "" data-lazy-src="https://pic1.afdiancdn.com/user/8a7f563c2e3811ecab5852540025c377/common/c9dcd19b9621a425f914ffb64cf2f8c1_w1920_h1080_s281.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-05-11</div><div class="title">Hexo Butterfly Algolia 搜索的使用</div></div></a></div><div><a href="/posts/yuque-to-hexo/" title="语雀文章同步至Hexo笔记"><img class="cover" src= "" data-lazy-src="https://pic1.afdiancdn.com/user/8a7f563c2e3811ecab5852540025c377/common/721e476cb2661152b9c43621c94e3ed7_w1366_h768_s86.png" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2022-10-04</div><div class="title">语雀文章同步至Hexo笔记</div></div></a></div><div><a href="/posts/2fa-last-security-line/" title="两步验证 最后一道安全防线"><img class="cover" src= "" data-lazy-src="https://pic1.afdiancdn.com/user/8a7f563c2e3811ecab5852540025c377/common/0d0f43b526a6944a65566a2fd7aa9939_w1920_h1080_s214.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-11-21</div><div class="title">两步验证 最后一道安全防线</div></div></a></div><div><a href="/posts/waline-comments-system-deployment-logs/" title="Waline 评论系统部署日志"><img class="cover" src= "" data-lazy-src="https://pic1.afdiancdn.com/user/8a7f563c2e3811ecab5852540025c377/common/edd977e4a8569283e89ac7426b67dfc3_w1920_h1080_s366.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-01-17</div><div class="title">Waline 评论系统部署日志</div></div></a></div></div></div><hr class="custom-hr"><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> 评论</span></div></div><div class="comment-wrap"><div><div id="waline-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link"><span class="toc-number">1.</span> <span class="toc-text">automerge-action</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#Usage"><span class="toc-number">1.1.</span> <span class="toc-text">Usage</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Configuration"><span class="toc-number">1.2.</span> <span class="toc-text">Configuration</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Supported-Events"><span class="toc-number">1.3.</span> <span class="toc-text">Supported Events</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Limitations"><span class="toc-number">1.4.</span> <span class="toc-text">Limitations</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Debugging"><span class="toc-number">1.5.</span> <span class="toc-text">Debugging</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#License"><span class="toc-number">1.6.</span> <span class="toc-text">License</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link"><span class="toc-number">2.</span> <span class="toc-text">bulldozer</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#Contents"><span class="toc-number">2.1.</span> <span class="toc-text">Contents</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Behavior"><span class="toc-number">2.2.</span> <span class="toc-text">Behavior</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Configuration-2"><span class="toc-number">2.3.</span> <span class="toc-text">Configuration</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#bulldozer-yml-Specification"><span class="toc-number">2.3.1.</span> <span class="toc-text">bulldozer.yml Specification</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#FAQ"><span class="toc-number">2.4.</span> <span class="toc-text">FAQ</span></a><ol class="toc-child"><li class="toc-item toc-level-4"><a class="toc-link" href="#Can-I-specify-both-ignore-and-trigger"><span class="toc-number">2.4.0.1.</span> <span class="toc-text">Can I specify both ignore and trigger?</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Can-I-specify-the-body-of-the-commit-when-using-the-squash-strategy"><span class="toc-number">2.4.0.2.</span> <span class="toc-text">Can I specify the body of the commit when using the squash strategy?</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#What-if-I-don%E2%80%99t-want-to-put-config-files-into-each-repo"><span class="toc-number">2.4.0.3.</span> <span class="toc-text">What if I don’t want to put config files into each repo?</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Bulldozer-isn%E2%80%99t-merging-my-commit-when-it-should-what-could-be-happening"><span class="toc-number">2.4.0.4.</span> <span class="toc-text">Bulldozer isn’t merging my commit when it should, what could be happening?</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Bulldozer-isn%E2%80%99t-updating-my-branch-when-it-should-what-could-be-happening"><span class="toc-number">2.4.0.5.</span> <span class="toc-text">Bulldozer isn’t updating my branch when it should, what could be happening?</span></a></li><li class="toc-item toc-level-4"><a class="toc-link" href="#Can-Bulldozer-work-with-push-restrictions-on-branches"><span class="toc-number">2.4.0.6.</span> <span class="toc-text">Can Bulldozer work with push restrictions on branches?</span></a></li></ol></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Deployment"><span class="toc-number">2.5.</span> <span class="toc-text">Deployment</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#GitHub-App-Configuration"><span class="toc-number">2.5.1.</span> <span class="toc-text">GitHub App Configuration</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Operations"><span class="toc-number">2.5.2.</span> <span class="toc-text">Operations</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Example-Files"><span class="toc-number">2.5.3.</span> <span class="toc-text">Example Files</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Migrating-Version-0-4-X-to-1-X"><span class="toc-number">2.5.4.</span> <span class="toc-text">Migrating: Version 0.4.X to 1.X</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Development"><span class="toc-number">2.6.</span> <span class="toc-text">Development</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Contributing"><span class="toc-number">2.7.</span> <span class="toc-text">Contributing</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#License-2"><span class="toc-number">2.8.</span> <span class="toc-text">License</span></a></li></ol><li class="toc-item toc-level-1"><a class="toc-link"><span class="toc-number">3.</span> <span class="toc-text">probot-auto-merge</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#Usage-2"><span class="toc-number">3.1.</span> <span class="toc-text">Usage</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Configuration-3"><span class="toc-number">3.2.</span> <span class="toc-text">Configuration</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#minApprovals-required-condition"><span class="toc-number">3.2.1.</span> <span class="toc-text">minApprovals (required, condition)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#requiredReviewers-condition-default-none"><span class="toc-number">3.2.2.</span> <span class="toc-text">requiredReviewers (condition, default: none)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#maxRequestedChanges-condition-default-none"><span class="toc-number">3.2.3.</span> <span class="toc-text">maxRequestedChanges (condition, default: none)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#blockingBaseBranches-condition-default-none"><span class="toc-number">3.2.4.</span> <span class="toc-text">blockingBaseBranches (condition, default: none)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#requiredBaseBranches-condition-default-none"><span class="toc-number">3.2.5.</span> <span class="toc-text">requiredBaseBranches (condition, default: none)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#blockingLabels-condition-default-none"><span class="toc-number">3.2.6.</span> <span class="toc-text">blockingLabels (condition, default: none)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#requiredLabels-condition-default-none"><span class="toc-number">3.2.7.</span> <span class="toc-text">requiredLabels (condition, default: none)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#blockingTitleRegex-condition-default-none"><span class="toc-number">3.2.8.</span> <span class="toc-text">blockingTitleRegex (condition, default: none)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#requiredTitleRegex-condition-default-none"><span class="toc-number">3.2.9.</span> <span class="toc-text">requiredTitleRegex (condition, default: none)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#blockingBodyRegex-condition-default-none"><span class="toc-number">3.2.10.</span> <span class="toc-text">blockingBodyRegex (condition, default: none)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#requiredBodyRegex-condition-default-none"><span class="toc-number">3.2.11.</span> <span class="toc-text">requiredBodyRegex (condition, default: none)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#reportStatus-default-false"><span class="toc-number">3.2.12.</span> <span class="toc-text">reportStatus (default: false)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#updateBranch-default-false"><span class="toc-number">3.2.13.</span> <span class="toc-text">updateBranch (default: false)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#deleteBranchAfterMerge-default-false"><span class="toc-number">3.2.14.</span> <span class="toc-text">deleteBranchAfterMerge (default: false)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#mergeMethod-default-merge"><span class="toc-number">3.2.15.</span> <span class="toc-text">mergeMethod (default: merge)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#mergeCommitMessage-default-none"><span class="toc-number">3.2.16.</span> <span class="toc-text">mergeCommitMessage (default: none)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#rules-default-none"><span class="toc-number">3.2.17.</span> <span class="toc-text">rules (default: none)</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#requiredAuthorRole-default-none"><span class="toc-number">3.2.18.</span> <span class="toc-text">requiredAuthorRole (default: none)</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Development-2"><span class="toc-number">3.3.</span> <span class="toc-text">Development</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Setup"><span class="toc-number">3.3.1.</span> <span class="toc-text">Setup</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Testing"><span class="toc-number">3.3.2.</span> <span class="toc-text">Testing</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Running"><span class="toc-number">3.3.3.</span> <span class="toc-text">Running</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Running-on-Docker"><span class="toc-number">3.3.4.</span> <span class="toc-text">Running on Docker</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Running-the-linter"><span class="toc-number">3.3.5.</span> <span class="toc-text">Running the linter</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Deployment-2"><span class="toc-number">3.4.</span> <span class="toc-text">Deployment</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Permissions"><span class="toc-number">3.4.1.</span> <span class="toc-text">Permissions</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#Events"><span class="toc-number">3.4.2.</span> <span class="toc-text">Events</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Contributing-2"><span class="toc-number">3.5.</span> <span class="toc-text">Contributing</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#License-3"><span class="toc-number">3.6.</span> <span class="toc-text">License</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link"><span class="toc-number">4.</span> <span class="toc-text">auto-label-merge-conflicts</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#Purpose"><span class="toc-number">4.1.</span> <span class="toc-text">Purpose</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Set-up"><span class="toc-number">4.2.</span> <span class="toc-text">Set up</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#Arguments"><span class="toc-number">4.2.1.</span> <span class="toc-text">Arguments:</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Limitations-2"><span class="toc-number">4.3.</span> <span class="toc-text">Limitations</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#Local-dev-setup"><span class="toc-number">4.4.</span> <span class="toc-text">Local dev setup</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link"><span class="toc-number">5.</span> <span class="toc-text">How to use PR Valet</span></a></li><li class="toc-item toc-level-1"><a class="toc-link"><span class="toc-number">6.</span> <span class="toc-text">https:&#x2F;&#x2F;docs.mergify.io&#x2F;</span></a></li><li class="toc-item toc-level-1"><a class="toc-link"><span class="toc-number">7.</span> <span class="toc-text">https:&#x2F;&#x2F;snyk.io&#x2F;</span></a></li></div></div></div></div></main><footer id="footer" style="background:linear-gradient(135deg,#fff1eb,#ace0f9)"><div id="footer-wrap"><div class="icp"><a target="_blank" rel="noopener external nofollow noreferrer" href="https://beian.miit.gov.cn"><img class="icp-icon" src= "" data-lazy-src="https://jsd.cdn.zzko.cn/gh/ccknbc-backup/cdn/logo/icp.png" alt="ICP"><span>鄂 ICP 备 2020019764 号</span></a></div><div class="gongan"><a target="_blank" rel="noopener external nofollow noreferrer" href="https://www.beian.gov.cn/portal/registerSystemInfo?recordcode=42088102000092"><img class="gongan-icon" src= "" data-lazy-src="https://jsd.cdn.zzko.cn/gh/ccknbc-backup/cdn/logo/gongan.png" alt="gongan"><span>鄂公网安备 42088102000092 号</span></a></div><div class="live"><span>本站已运行</span><span id="display_live"></span><span class="moe-text">CCKNBC All Rights Reserved.</span><script>function blog_live(){window.setTimeout(blog_live,1e3);var e=new Date("2020-06-04T00:00:00"),o=new Date,l=o.getFullYear(),o=o.getTime()-e.getTime(),e=864e5,t=365*e,i=Math.floor(o/t),t=Math.floor(o%t/e),e=Math.floor(o%e/60/60/1e3),a=Math.floor(o%36e5/60/1e3),o=Math.floor(o%6e4/1e3);display_live.innerHTML=" "+i+" 年 "+t+" 天 "+e+" 小时 "+a+" 分 "+o+" 秒<br>&copy; 2020 - "+l+" "}blog_live()</script></div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><a class="edit-yuque" target="_blank" rel="noopener external nofollow noreferrer" href="https://www.yuque.com/ccknbc/blog/21/edit/" title="在语雀上以富文本格式编辑/预览 - GitHub 自动合并 PR 笔记"><i class="fa-solid fa-crow"></i></a><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fa-solid fa-arrows-alt-h"></i></button><button id="readmode" type="button" title="阅读模式"><i class="fa-solid fa-book-open"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fa-solid fa-adjust"></i></button></div><div id="rightside-config-show"><button id="rightside-config" type="button" title="设置"><i class="fa-solid fa-cog"></i></button><button id="share-link" type="button" title="分享链接"><i class="fa-solid fa-share"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fa-solid fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="直达评论"><i class="fa-solid fa-comments"></i></a><button id="go-up" type="button" title="回到顶部"><span class="scroll-percent"></span><i class="fa-solid fa-arrow-up"></i></button></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://jsd.cdn.zzko.cn/npm/@fancyapps/ui/dist/fancybox/fancybox.umd.js"></script><script src="https://jsd.cdn.zzko.cn/npm/instant.page/instantpage.js" type="module"></script><script src="https://jsd.cdn.zzko.cn/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="https://jsd.cdn.zzko.cn/npm/node-snackbar/dist/snackbar.min.js"></script><div class="js-pjax"><script>(()=>{var e=()=>{var e;const t=document.querySelectorAll("#article-container .mermaid-wrap");0!==t.length&&(e=()=>{{var e=t;window.loadMermaid=!0;const a="dark"===document.documentElement.getAttribute("data-theme")?"dark":"default";Array.from(e).forEach((e,t)=>{const n=e.firstElementChild;e="%%{init:{ 'theme':'"+a+"'}}%%\n"+n.textContent;const d=mermaid.render("mermaid-"+t,e);"string"==typeof d?(t=d,n.insertAdjacentHTML("afterend",t)):d.then(({svg:e})=>{n.insertAdjacentHTML("afterend",e)})})}},btf.addGlobalFn("themeChange",e,"mermaid"),window.loadMermaid?e():btf.getScript("https://jsd.cdn.zzko.cn/npm/mermaid/dist/mermaid.min.js").then(e))};btf.addGlobalFn("encrypt",e,"mermaid"),window.pjax?e():document.addEventListener("DOMContentLoaded",e)})()</script><script>(()=>{let n=window.walineFn||null;const t=e=>{const n=e(Object.assign({el:"#waline-wrap",serverURL:"https://waline.ccknbc.cc",pageview:!1,dark:'html[data-theme="dark"]',path:window.location.pathname,comment:!1,imageUploader:function(e){var n=new FormData,t=new Headers;return n.append("file",e),n.append("album_id","10"),n.append("permission","0"),t.append("Authorization","Bearer 24|o8Crl5y0oK3luyUs17fBxDtAcevk1iiLHVFMNjpA"),t.append("Accept","application/json"),fetch("https://wmimg.com/api/v1/upload",{method:"POST",headers:t,body:n}).then(e=>e.json()).then(e=>e.data.links.url)}},{pageSize:10,meta:["nick","mail","link"],requiredMeta:["nick","mail"],login:"force",copyright:!0,search:!0,turnstileKey:"0x4AAAAAAAECBl27OB5SZrQT",locale:{admin:"博主",sofa:"这里冷冷清清的，快来留下脚印吧！",placeholder:"根据《互联网跟帖评论服务管理规定》，将展示您的归属地，并开启强制注册登录后才允许评论\n社交登录现已支持【QQ Weibo GitHub X Facebook】等平台，登录后可点击头像更改个人主页地址，方便CC串门\n在评论框粘贴图片，自动上传至图床，请不要将评论区作为您的图床，更不要上传违法图片，谢谢合作",reactionTitle:"就现在，表明你的态度！",reaction0:"鼓励",reaction1:"菜狗",reaction2:"正确",reaction3:"错误",reaction4:"思考",reaction5:"无聊",level0:"买菜",level1:"切菜",level2:"炒菜",level3:"煲汤",level4:"煮面",level5:"上桌",level6:"开吃"},emoji:["https://jsd.cdn.zzko.cn/npm/sticker-heo/Sticker-100/"],reaction:["https://jsd.cdn.zzko.cn/npm/sticker-heo/Sticker-100/鼓掌.png","https://jsd.cdn.zzko.cn/npm/sticker-heo/Sticker-100/菜狗.png","https://jsd.cdn.zzko.cn/npm/sticker-heo/Sticker-100/正确.png","https://jsd.cdn.zzko.cn/npm/sticker-heo/Sticker-100/错误.png","https://jsd.cdn.zzko.cn/npm/sticker-heo/Sticker-100/思考.png","https://jsd.cdn.zzko.cn/npm/sticker-heo/Sticker-100/睡觉.png"]}));btf.addGlobalFn("pjax",()=>{n.destroy()},"destroyWaline")};var e=()=>{n?t(n):(btf.getCSS("https://jsd.cdn.zzko.cn/npm/@waline/client/dist/waline.css"),btf.getCSS("https://jsd.cdn.zzko.cn/npm/@waline/client/dist/waline-meta.css").then(()=>import("https://jsd.cdn.zzko.cn/npm/@waline/client/dist/waline.js")).then(({init:e})=>{n=e||Waline.init,t(n),window.walineFn=n}))};btf.loadComment(document.getElementById("waline-wrap"),e)})()</script></div><script>window.addEventListener("load",()=>{const t=e=>e=""!==e&&150<(e=(e=(e=(e=e.replace(/<img.*?src="(.*?)"?[^\>]+>/gi,"[图片]")).replace(/<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi,"[链接]")).replace(/<pre><code>.*?<\/pre>/gi,"[代码]")).replace(/<[^>]+>/g,"")).length?e.substring(0,150)+"...":e,a=t=>{let a="";if(t.length)for(let e=0;e<t.length;e++)a=(a+="<div class='aside-list-item'>")+`<div class='content'>
        <a class='comment' href='${t[e].url}' title='${t[e].content}'>${t[e].content}</a>
        <div class='name'><span>${t[e].nick} / </span><time datetime="${t[e].date}">${btf.diffDate(t[e].date,!0)}</time></div>
        </div></div>`;else a+="没有评论";var e=document.querySelector("#card-newest-comments .aside-list");e&&(e.innerHTML=a),window.lazyLoadInstance&&window.lazyLoadInstance.update(),window.pjax&&window.pjax.refresh(e)};var e=()=>{var e;document.querySelector("#card-newest-comments .aside-list")&&((e=btf.saveToLocal.get("waline-newest-comments"))?a(JSON.parse(e)):(async()=>{try{var e=(await(await fetch("https://waline.ccknbc.cc/api/comment?type=recent&count=3",{method:"GET"})).json()).data.map(e=>({content:t(e.comment),avatar:e.avatar,nick:e.nick,url:e.url+"#post-comment",date:e.time||e.insertedAt}));btf.saveToLocal.set("waline-newest-comments",JSON.stringify(e),10/1440),a(e)}catch(e){console.error(e),document.querySelector("#card-newest-comments .aside-list").textContent="无法获取评论，请确认相关配置是否正确"}})())};e(),btf.addGlobalFn("pjaxComplete",e,"waline_newestComment")})</script><script defer src="/js/custom.js"></script><script src="https://jsd.cdn.zzko.cn/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors=["head > title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show",".js-pjax"];var pjax=new Pjax({elements:'a:not([target="_blank"])',selectors:pjaxSelectors,cacheBust:!1,analytics:!1,scrollRestoration:!1});const triggerPjaxFn=e=>{e&&Object.values(e).forEach(e=>{e()})};document.addEventListener("pjax:send",function(){btf.removeGlobalFnEvent("pjax"),btf.removeGlobalFnEvent("themeChange");var e=document.body.classList;e.contains("read-mode")&&e.remove("read-mode"),triggerPjaxFn(window.globalFn.pjaxSend)}),document.addEventListener("pjax:complete",()=>{document.querySelectorAll("script[data-pjax]").forEach(e=>{const t=document.createElement("script");var a=e.text||e.textContent||e.innerHTML||"";Array.from(e.attributes).forEach(e=>t.setAttribute(e.name,e.value)),t.appendChild(document.createTextNode(a)),e.parentNode.replaceChild(t,e)}),triggerPjaxFn(window.globalFn.pjaxComplete)}),document.addEventListener("pjax:error",e=>{404===e.request.status&&pjax.loadUrl("/404")})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div class="docsearch-wrap"><div id="docsearch" style="display:none"></div><link rel="stylesheet" href="https://jsd.cdn.zzko.cn/npm/@docsearch/css/dist/style.css"><script src="https://jsd.cdn.zzko.cn/npm/@docsearch/js/dist/umd/index.js"></script><script>(()=>{docsearch(Object.assign({appId:"97MUPN4DMC",apiKey:"a003a39f337f5186ec11f5f92bae62b3",indexName:"ccknbc",container:"#docsearch"},{placeholder:"Ctrl/⌘ + K 唤醒搜索服务",maxResultsPerGroup:7,translations:{button:{buttonText:"搜索",buttonAriaLabel:"搜索"},modal:{searchBox:{resetButtonTitle:"清空",resetButtonAriaLabel:"清空",cancelButtonText:"取消",cancelButtonAriaLabel:"取消"},startScreen:{recentSearchesTitle:"最近搜索历史",noRecentSearchesText:"搜索历史为空",saveRecentSearchButtonTitle:"保存搜索记录",removeRecentSearchButtonTitle:"清除搜索记录",favoriteSearchesTitle:"收藏夹",removeFavoriteSearchButtonTitle:"移出收藏夹"},errorScreen:{titleText:"未能获取搜索结果",helpText:"您可能需要检查您的网络连接"},footer:{selectText:"选择",selectKeyAriaLabel:"回车键",navigateText:"切换",navigateUpKeyAriaLabel:"方向键上",navigateDownKeyAriaLabel:"方向键下",closeText:"关闭",closeKeyAriaLabel:"退出键",searchByText:"搜索服务提供: DocSearch by"},noResultsScreen:{noResultsText:"未搜索到相关内容",suggestedQueryText:"您可尝试搜索",reportMissingResultsText:"确认搜索结果是正确的？",reportMissingResultsLinkText:"反馈给Algolia"}}}}));const e=()=>{document.querySelector(".DocSearch-Button").click()};var t=()=>{btf.addEventListenerPjax(document.querySelector("#search-button > .search"),"click",e)};t(),window.addEventListener("pjax:complete",t)})()</script></div></div><script>const copyright_enable=!0</script><script src="https://jsd.cdn.zzko.cn/npm/turndown/dist/turndown.min.js"></script><script src="https://jsd.cdn.zzko.cn/gh/ccknbc-forked/hexo-butterfly-copymarkdown/lib/copyMarkdown.min.js"></script><script src="https://jsd.cdn.zzko.cn/gh/ccknbc-forked/hexo-butterfly-copymarkdown/lib/reprint.min.js"></script><script>(function (w, d, s, id) {
        if (typeof (w.webpushr) !== 'undefined') return;
        w.webpushr = w.webpushr || function () { (w.webpushr.q = w.webpushr.q || []).push(arguments) };
        var js, fjs = d.getElementsByTagName(s)[0];
        js = d.createElement(s);
        js.id = id;
        js.async = 1;
        js.src = "https://cdn.webpushr.com/app.min.js";
        fjs.parentNode.appendChild(js);
        }(window, document, 'script', 'webpushr-jssdk'));

        webpushr('setup', {
        'key': 'BB9Y-w9p3u0CKA7UP9nupB6I-_NqE2MuODmKJjyC4W2YflX06Ff_hEhrNJfonrut5l6gCa28gC83q2OII7Qv-oA',
        'sw': 'none'
        });
        </script></body></html>